CM2012 – Redistribute content with errors
Here’s a quick script that will redistribute all content that has errors to the DPs it errored out on.
$Server = "CM2012"
$Namespace = "root\sms\site_PS1"
$strQuery = "Select Name,PackageID from SMS_DistributionDPStatus where MessageState > 2"
Get-WmiObject -Query $strQuery -Namespace $Namespace -ComputerName $Server | ForEach-Object {
$ServerName = $_.Name
$ServerName = $ServerName.ToUpper()
$PackageID = $_.PackageID
$strQuery = "select * from SMS_DistributionPoint where PackageID = '$PackageID'"
$PackageDPGroup = Get-WmiObject -Query $strQuery -Namespace $Namespace -ComputerName $Server
foreach ($PackageDP in $PackageDPGroup) {
$NalPath = $PackageDP.ServerNalPath
if ($NalPath.ToUpper().Contains("$ServerName")) {
$Error.Clear()
$PackageDP.RefreshNow = $true
$PackageDP.Put()
}
}
}
Just run this, and in a few minutes you’ll see your content start to redistribute on the DPs it errored on.
Leave a Comment