Monday, September 11, 2017

Powershellist - Remove a package from all distribution points

DexterPOSH originally created this script - however I feel it wasn't quite explained correctly (not to mention typed out for an easy copy/paste), so I'm re-blogging it here.  This Powershell script removes a package from all Distribution Points easily.  This is much easier than removing the package content from each individual distribution point from the Content Locations tab of the Package Properties (especially since I am currently working with 250 DP's):

Get-CimInstance -ClassName SMS_DistributionPoint -Namespace root/sms/site_A01 -ComputerName SCCMA01 | Where {$_.PackageID -eq "A01002C9"} | Remove-CimInstance -Verbose
 Be sure to edit the values in bold to fit your own environment (Site Code, Primary Site Server, and PackageID).

I have found this helpful when removing expired/old packages to free up space on all DP's.

No comments:

Post a Comment