We have all seen this in the past and no matter how hard we try to fix this BAU issue, and often we are pressed for time because this blocks a Task Sequence deployment, we find ourselves pulling our hair and having to buy a new keyboard (?).
Here’s a way to fix the issue 100% of the time (Believe me, I’ve tried!).
In the below example, you can see that a driver package is in the “In Progress” status for 1 server.
Under the Administration node, go to Distribution Points and search for that one Distribution Point (DP); go to its Properties.
Under the ‘Content’ tab, search for the stuck package (It’s easier and faster to search by ID) and remove it.
Copy / paste and execute the below PowerShell script (just make sure you enter your DP’s FQDN and the stuck package’s ID”.
$DPName = “yourDP.yourdomain.local “
$PkgID = “CAS018B2”
# ======= DO NOT MODIFY THE BELOW ======= #
$creds = Get-Credential
#remove from wmi
Get-WmiObject -ComputerName $DPName -Namespace Root\SCCMDP -Class SMS_PackagesInContLib -Filter “PackageID = ‘$PkgID'” | Remove-WmiObject
#remove from content library
$ContentLib = Invoke-Command -ComputerName $DPName -Credential $creds -ScriptBlock {(Get-ItemProperty HKLM:SOFTWARE\Microsoft\SMS\DP).ContentLibraryPath}
$driveletter = $ContentLib[0]
$Location = “\\” + $DPName + “\$driveletter$\sccmcontentlib\pkglib”
Set-Location $Location
Remove-Item “$PkgID.INI”
Set-Location $env:SystemDrive
write-host “Done! $PkgID was removed from both WMI and Content Library on $DPName” -ForegroundColor Yellow
What does the script do?
It removes the package’s reference from the DP’s WMI database and from the Content Library.
There is no error handling on the script so you may get an error if:
- The package reference does not exist in WMI or in the Content Library
- You do not have PowerShell remoting enabled on
the DP
Go back to the console and under the Software Library node, go to Driver Packages, find the package and re-distribute it.
Follow the Wizard’s instructions
Select the DP where you removed the package from
Complete the content distribution process
After a few minutes (depending on your package size and network bandwidth between the package source files and the DP), the content status will change to “Success”. A little bit later it’ll get validated.