How to delete multiple Packages using PowerShell with ConfigMgr 2012 SP1


How many times have you had the need to delete multiple packages in a ConfigMgr test site?  In order to do this, you right-click on the package and select Delete.  You get presented a welcome screen, then you are asked if you want to see more information.  If you select no, then you are presented a summary screen, progress and then a completion screen (in which you need to click close).  That is something like six clicks just to delete a package.  In addition, you cannot multi-select a bunch of packages and delete them.  So, if you have 100 packages that you want to delete, you are looking at about 600+ clicks.  I am not sure about you, but that does not sounds like fun.

After launching PowerShell (this can be done from the ConfigMgr Admin Console), you can avoid all of these clicks with just a few commands.

If you just simply want to remove a package without using the console and have to click through all dialogs, simply use the following command:

Remove-CMPackage-Name“Test Package”Force

The Name parameter does take wildcards, so if you have multiple packages with a common name (i.e. Test Package 1, Test Package 2, etc.), then you can simply add the asterisk:

Remove-CMPackage-Name“Test Package*”Force

Using –Force means that it will not prompt you for confirmation to delete the package.

Now, say you want to delete all packages that don’t have an empty Manufacturer field, 1E packages or Microsoft packages.  Use the following command to get all of the package names:

$pkgs=Get-CMPackage|Where-Object {$_.Manufacturer -ne“”-and$_.Manufacturer -ne“1E”-and$_.Manufacturer -notlike“Microsoft*”} |SelectName

You can then just type $pkgs at the command prompt to see all of the packages that meet the criteria.

If you want to check to see what will happen before deleting all of the packages (in other words, there is no undo Embarrassed smile), run the following command:

$pkgs|% {Remove-CMPackage-name$_.Name -WhatIf}

This will display what kind of damage will be done before anything happens.

When the results are what you expect, run the following command:

$pkgs|% {Remove-CMPackage-name$_.Name -Force}

If you want to confirm each package deletion, simply leave the –Force off and it will have you confirm each one.  Remember, there is no Recycle Bin so use this with extreme care.

Mike Terrill | Systems Management Practice Lead

To explore this issue further, or discuss other industry challenges, contact us at, or join our LinkedIn forum, 1E INSIDEV1EW.

If you found this article helpful, please take a moment to share it with your contacts using the social media buttons to the left.

about Mike Terrill

Mike Terrill is the Product Manager for Windows Migrations and User-centric Application Management at 1E. He is focused on Windows Systems Management and Operating System Deployment using Microsoft and 1E technologies. Mike's specializes in System Center 2012 Configuration Manager and he has been using this product since Systems Management Server (SMS) 1.2. He has designed, architected, implemented, and worked with some of the leading top Fortune companies. In his previous role at 1E as the Systems Management Practice Lead, Mike's last project in 1E Professional Services included deploying System Center 2012 Configuration Manager and Windows 7 to a 450K seat environment.  Mike is also the founder and user group leader for the Arizona Systems Management User Group (, and blogs at

Would you like to share your thoughts?

Your email address will not be published.

Please type the characters of this captcha image in the input box