There are times when a GUI interface is perfectly fine when performing administration tasks. At other times, it just outright sucks. If you have ever had to delete multiple Packages in Configuration Manager 2012 (SP1) from the GUI management tool, you probably know what I’m talking about. If you really like clicking through multiple screens on a wizard, please continue doing that and you can stop reading further. However, if you would prefer to see a simpler method by using PowerShell, please read on.
I found this simple article from Mike Terrill (works for 1E) with instructions to perform this tedious task using PowerShell. I am including a quick snippet below. For the full article, please go directly to Mike’s blog post.
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: