I  recently spotted a request where someone was looking for a means of reporting on Applications and Packages which were not deployed or used in task sequences in their ConfigMgr environment. The reason of course was for clean up purposes, as it is often the case that software gets added in for test or other purposes and never makes it through to being deployed or is withdrawn but not removed from the database.

How to report on these items?

There are several ways to achieve this but I thought wouldn’t it be fun to use PowerShell. So here is a link to a script that will display either a list of applications or packages, along with their current deployment state / number of deployments and a count of the number of task sequences they are referenced in – https://gallery.technet.microsoft.com/scriptcenter/Application-Package-Usage-3ed3e14a

Running the script

To run the script launch an elevated PowerShell session and type in the following;

 .\Get-AppPackageCleanUp.ps1 -PackageType Applications -SiteServer YOURSITESERVER
In this mode the script will present a list of Applications in a data grid

 .\Get-AppPackageCleanUp.ps1 -PackageType Packages -SiteServer YOURSITESERVER -ExportCSV True
In this mode the script will output a list of packages to a CSV file 

Grid View Output

Applications Report Grid View

Packages Report Grid View

CSV Export

The output is displayed in a grid view by default, however if you use the -ExportCSV True switch it will export the contents out to a CSV where you can interrogate the data further.

You could go a step further by reading in an updated CSV containing only apps you wish to remove and use the Remove-CMPackage / Remove-CMApplication commands for a quick spring clean of your environment.

Sample PowerShell application clean up command
$Applications = Import-CSV -Path .\ApplicationCleanUpReport.csv
$AppsToClear = $Applications | Where-object {($_."Application Deployed" -eq $false) -and ($_."Task Sequence References" -eq 0)}
foreach ($App in $AppsToClear)
  Remove-CMApplication -Name $App."Application Name" -Force

In the above few lines of code (run from a ConfigMgr PS consle) you would remove all applications not referenced in task sequences or deployed.


Using PowerShell is a very powerful means of drilling down into data, allowing you to generate ad hoc reports on the fly. Be careful however when using the Remove command as it will not be forgiving.

Maurice Daly
Maurice has been working in the IT industry since 1999 and was awarded his first MVP Enterprise Mobility award in 2017. Technology focus includes Active Directory, Group Policy, Hyper-V, Windows Deployment (SCCM & MDT) and Office 365.


  • Peter Fitch
    Posted at 18:25 August 14, 2017
    Peter Fitch


    Thank you for this post. It’s exactly what I’m looking for to help cleanup some of my older updates. I’m having trouble getting it to run though. I’ve unblocked the script so that it can run but I cannot set the execution policy to unrestricted in the SCCM powershell module. Any suggestions as to how I can easily do this?


    • Maurice Daly
      Posted at 23:32 August 14, 2017
      Maurice Daly

      Hi Peter,

      Launch a PowerShell session using the -ExecutionPolicy Bypass switch, that should allow you to run the script.


  • Leave a Reply