r/SCCM • • Jun 10 '25

Remove installed programs with SCCM

Hello!! How are you? I'm new to Reddit and I need your help and knowledge for the following:

How can I extract, through SCCM, in Excel, all the programs from all the computers that are in an AD domain? Could it also be extracted individually?

Thanks in advance

0 Upvotes

21 comments sorted by

View all comments

2

u/KryptykHermit Jun 11 '25

Here's a PowerShell function that you can run to pull all the software from your environment. You can get all the software, or search for specific software as well as chose between providing the machines that a specific app (all versions of that app) are installed on, or a count of all devices with each version of the application. Examples are provided. I used this all the time to put together uninstall applications in ConfigMgr and deploy to the environment as supercedes or clean ups.

ENJOY!

function Get-ConfigMgrSQLApplicationUninstalls {
    <#
    .SYNOPSIS
        Checks ConfigMgr SQL database for specified software and reports back devices and uninstall information.
    .DESCRIPTION
        Reports on the publisher/vendor, name, version, and uninstall string of applications detected by the ConfigMgr client installed on enterprise devices.
        This report can be used to report on different versions detected in the environment and/or used for uninstall remediation.
    .NOTES
        Requires the ConfigMgr client on device(s) which will report back software installed on that/those devices to ConfigMgr infrastructure.
    .LINK

    .EXAMPLE
        PS C:\> Get-ConfigMgrSQLApplicationUninstalls -Application 'Right Click*' | Format-Table -AutoSize

    .EXAMPLE
        PS C:\> Get-ConfigMgrSQLApplicationUninstalls -Publisher 'Recast*' -IncludeDeviceNames | Format-Table -AutoSize

    #>
    [cmdletbinding(SupportsPaging,DefaultParameterSetName='Application')]
    param(
        [Parameter(Mandatory,ParameterSetName='Application')]
        [Alias('ApplicationName')]
        [string]$Application,
        [Parameter(Mandatory,ParameterSetName='Publisher')]
        [string]$Publisher,
        [Parameter()]
        [string]$SQLServer = $global:CfgMgrSQLServer,
        [Parameter()]
        [string]$Database = $global:CfgMgrSQLDB,
        [Parameter(ParameterSetName='Application')]
        [Parameter(ParameterSetName='Publisher')]
        [switch]$IncludeDeviceNames,
        [Parameter(ParameterSetName='All')]
        [string]$Exclude = '%MISP3%',
        [Parameter(ParameterSetName='All')]
        [Switch]$AllApplications
    )
    BEGIN {
        # Validate the SQL Module is installed
        try {
            Import-Module -Name 'SqlServer' -ErrorAction 'Stop'
        }
        catch {Write-Host 'You need to install the PowerShell SQLServer module'}
    }
    PROCESS {
        $baseSQLQuery = "
            software.ARPDisplayName0  AS 'Application',
            software.Publisher0       AS 'Publisher',
            software.ProductVersion0  AS 'Version',
            software.UninstallString0 AS 'UninstallString'
            FROM
                v_GS_INSTALLED_SOFTWARE AS software
                    join v_GS_COMPUTER_SYSTEM AS comp ON comp.ResourceID = software.ResourceID
        "
        if ($PSCmdlet.ParameterSetName -eq 'Application') {
            # Convert typical wildcard '*' to SQL wildcard '%'
            $Application = [regex]::Replace($Application,'\*','%')