Hi,
I wrote this script for our environment, it beats clicking stuff.
$SiteCode = "ABC"
$PackageState = "3"
$FailedPackages = Get-WmiObject -Namespace "Root\SMS\Site_$($SiteCode)" -Query "select * from SMS_PackageStatusDistPointsSummarizer where state = $($PackageState)"
if ($FailedPackages.Count -gt 0)
{
Write-Host "There are $($FailedPackages.Count) Failed Packages at the moment."
}
elseif ($FailedPackages)
{
Write-Host "There is 1 Failed Package at the moment."
}
else
{
Write-Host "There are 0 at the moment."
}
if ($FailedPackages)
{
foreach ($FailedPackage in $FailedPackages)
{
try
{
$DistributionPointObj = Get-WmiObject -Namespace "root\SMS\Site_$($SiteCode)" -Class SMS_DistributionPoint -Filter "PackageID='$($FailedPackage.PackageID)' and ServerNALPath like '%$($FailedPackage.ServerNALPath.Substring(12,7))%'"
$DistributionPointObj.RefreshNow = $True
$result = $DistributionPointObj.Put()
Write-Host "Refreshed $($FailedPackage.PackageID) on $($FailedPackage.ServerNALPath.Substring(12,7)) - State was: $($FailedPackage.State)"
}
catch
{
Write-Host "Unable to refresh package $($FailedPackage.PackageID) on $($FailedPackage.ServerNALPath.Substring(12,7)) - State was: $($FailedPackage.State)"
write-host $Error
}
}
}
Most of our DP's are now PullDPs. When they fail, we find that restarting ccmexec and BITS helps a bit before redistributing.
Cheers!