Skip to main content

Posts

Showing posts with the label DistributionPoint

PowerShell + SCCM 2012 : Get-DPContent (Get all the Packages stored on a DP)

This week when came back from office , saw this tweet from Adam Bertram : It got me curious how to Script this, I had written a Script in past to remove packages from the DP . So let's try out this scenario. The class to query is the SMS_DistributionPoint class and the property to be used for filtering is ServerNALPath. My Lab has only one DP named "DexSCCM" so gonna use that in the filter. Note the WQL operator used here for filtering is LIKE not '='. 001 Get-CimInstance   -ClassName   SMS_DistributionPoint   -Filter   "ServerNALPAth LIKE '%DexSCCM%'"   -ComputerName   dexsccm   -Namespace   Root\SMS\Site_DEX This will give you a bunch of objects back , below is one of the objects screenshot: Note - Please take a moment to go to the MSDN documentation of the SMS_DistributionPoint WMI Class and pay attention to the ObjectTypeID , SecureObjectID and PackageID properties. From the above Objects I c...

Use PowerShell to remove packages from the Distribution Points

This post is inspired by one of the activities which we had to recently do. We have a lot of branch DP's where we want to cleanup all the obsolete packages (which are not used anymore). This can be done manually by going in the ConfigMgr Console Packages node and updating the DP's manually for each package. But where is fun in doing that ...Lol I couldn't find much on the internet ..So I tested it in my Lab first and then in QA in our environment and then did it in PROD. For this post demonstration I am showing this on my LAB (ConfigMgr12) but it does work with ConfigMgr07. Note - ConfigMgr 2012 R2 has this cmdlet  Remove-CMContentDistribution which can do this but am showing the method which will work with all ConfigMgr versions (hopefully). Right now I have distributed 3 packages to the only DP (DexSCCM) in my environment. Now we can get the same Information about which DP the particular package is Distributed by querying the SMS_DistributionPoint Class. ...