In SCCM when there are many Distribution Points with different published Software, it may happen that there are validation failures and that WMI repository is inconsistent. The events are represented as in the following table:
SCCM by default does not have any tools that allow you to resynchronize the entire WMI repository without removing the Distribution Point Role and adding it again. Let's see how to get around this.
Other events that you can have when there are failures of this kind:- Monitoring - Distribution Points (In SCCM Server):
- Lof File in the Distribution PointsServer (smsdpmon.log)
- The Package data in WMI is not consistent to PkgLib
To workaround this, you can copy the following Powershell code in CleanDP.ps1 for example and run on all Distribution Points with errors:
$WMIPkgList = Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib | Select -ExpandProperty PackageID | Sort-Object
$ContentLib = (Get-ItemProperty -path HKLM:SOFTWARE\Microsoft\SMS\DP -Name ContentLibraryPath)
$PkgLibPath = ($ContentLib.ContentLibraryPath) + "\PkgLib"
$PkgLibList = (Get-ChildItem $PkgLibPath | Select -ExpandProperty Name | Sort-Object)
$PkgLibList = ($PKgLibList | ForEach-Object {$_.replace(".INI","")})
$PksinWMIButNotContentLib = Compare-Object -ReferenceObject $WMIPkgList -DifferenceObject $PKgLibList -PassThru | Where-Object { $_.SideIndicator -eq "<=" }
$PksinContentLibButNotWMI = Compare-Object -ReferenceObject $WMIPkgList -DifferenceObject $PKgLibList -PassThru | Where-Object { $_.SideIndicator -eq "=>" } Write-Host Items in WMI but not the Content Library
Write-Host ========================================
$PksinWMIButNotContentLib
Write-Host Items in Content Library but not WMI
Write-Host ====================================
$PksinContentLibButNotWMI
Foreach ($Pkg in $PksinWMIButNotContentLib){
Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib -Filter "PackageID = '$Pkg'" | Remove-WmiObject -Confirm
}
Foreach ($Pkg in $PksinContentLibButNotWMI){
Remove-Item -Path "$PkgLibPath\$Pkg.INI" -Confirm
When running the Script will see the differences between the software that actual exists and the WMI repository. You can delete the references so that they are synchronized again:
See you next time!
Nice! Thanks!
ReplyDelete