You are currently viewing How to troubleshoot the “Failed to retrieve the package list…” error

How to troubleshoot the “Failed to retrieve the package list…” error

When you check the status of the deployment of your packages on the distribution points, you can see that some packages contain a warning. In the details of the message, you will find the message “Failed to retrieve the package list on the distribution point”. This is a fairly common error. This article explains the cause of this warning and how to solve this problem.

Cause of the warning message

There are essentially two different lists of content packages on a distribution point (DP), and they must match each other. One is in WMI, and the other is the list of file objects in the PkgLib folder of the DP’s content library. In addition, any package listed on the distribution point should also be listed in the package list on your main site server.

If the two lists on the distribution point do not match, you will get a warning status. Or, if a package ID exists on your DP, but no longer exists in the main list on your primary site server (probably because you deleted the application/package that created it), then you have orphaned package IDs on the DP that need to be cleaned up. This will also result in a warning status.

 Failed to retrieve the package list
Detail of the warning message Failed to retrieve the package list on the distribution point.

How to resolve the “Failed to retrieve the package list on the distribution point” warning

Reminder

For information, since Current Branch 2010, the ContentLibraryCleanup.exe tool also removes orphaned WMI records on the distribution point. The use of this tool is detailed in the article “How to clean distribution points”.

The script below will check the two lists for a match. For each entry that is not consistent, a message will be displayed asking if you wish to remove the entry from the package.

$WMIPkgList = Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib | Select -ExpandProperty PackageID | Sort-Object
$ContentLib = (Get-ItemProperty HKLM:SOFTWARE\Microsoft\SMS\DP).ContentLibraryPath
$PkgLibPath = ($ContentLib) + "\PkgLib"
$PkgLibList = (Get-ChildItem $PkgLibPath | Select -ExpandProperty Name | Sort-Object)
$PkgLibList = ($PKgLibList | ForEach-Object {$_.replace(".INI","")})
$PksinWMIButNotContentLib = Compare-Object -ReferenceObject $WMIPkgList -DifferenceObject $PKgLibList -PassThru

##### section 1 #######################
Write-Host Items in WMI but not the Content Library
Write-Host ========================================
$PksinWMIButNotContentLib
Foreach ($Pkg in $PksinWMIButNotContentLib){
    Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib -Filter "PackageID = '$Pkg'" | Remove-WmiObject -Confirm
}
###### end section 1 ##################

##### section 2 #######################
Write-Host Items in Content Library but not WMI
Write-Host ====================================
$PksinContentLibButNotWMI
Foreach ($Pkg in $PksinContentLibButNotWMI){
   Remove-Item -Path "$PkgLibPath\$Pkg.INI" -Confirm
}
##### end section 2 ###################

Once the script is complete, run a content validation so that SCCM checks the consistency of the content library and the WMI list again.

Conclusion

Although this is a simple warning, it is useful to deal with it in order to keep a healthy infrastructure. With this script, it is easy to remove this warning and turn the distribution point green.

Leave a Reply