Applies to: Windows PowerShell 3.0+, SCCM
In the process of migrating to a new System Center Configuration Manager installation, I was tasked with stopping all of the old Configuration Manager application deployments. I didn’t end up counting how many there were, but it was more than I was willing to manually remove! Which brings us to why I’m writing this blog post. When you use the Remove-CMDeployment cmdlet in PowerShell you need two pieces of information, the application name and the collection name. At first I thought this was rather useless, because if I knew that I’d be looking at the deployment already in the console and could delete it then.
However after some brain storming, I discovered a Config Manager report that lists all application deployments with several columns of data. Two of the columns fortunately had the application name and collection name listed in it. The name of this report is “All application deployments (advanced)”. Which can be found under the following path Software Distribution > Application Monitoring > All application deployments (advanced). Since this report contains several other unneeded fields, I exported it to a .csv file then removed all unnecessary columns. Now that we know the application name and the collection name, we can easily automate the removal of these deployments with PowerShell! Below is a screen shot of the report for reference and below that is the PowerShell code to use for removing the application deployments.