This page looks best with JavaScript enabled

SCCM Bulk Uninstall Application

 ·  ☕ 5 min read

Bulk App Uninstall

MSSQL

Grabbing Uninstall GUIDs

We first need to gather the uninstall strings for the application we want to install so we can utilize them to create our SCCM package.

  • Open Microsoft SQL Management Studio and connect to your SCCM Database Server.
  • Expand your server, expand databases, right click your SCCM database and select “New Query”
  • In the new query window that appears run the query below, replacing Symantec Endpoint with the application of your choosing.
1
2
3
select distinct DisplayName0,ProdID0 [uninstallString],COUNT(*) as 'Total'
from v_ADD_REMOVE_PROGRAMS where DisplayName0 like 'Symantec Endpoint%'
group by DisplayName0,ProdID0

You should get results that look something like this:

SQL Example
Figure 1: Uninstall GUIDs

Powershell Application Deployment Toolkit

  • Now we are going to utilize the Powershell Application Deployment Toolkit to build our package.
  • Head on over to their Github to download it now.
  • Extract the zip file to your SCCM content location and edit the Deploy-Application.ps1 file with your favorite editor e.g. \\sccm\packages\Supplemental\Symantec\SEPUninstall

 
Starting around line 60 we have the Variable Declaration be sure to set: appVendor, appName, and appAuthor

60
61
62
63
64
65
66
67
68
69
70
71
72
73
##*===============================================
##* VARIABLE DECLARATION
##*===============================================
## Variables: Application
[string]$appVendor = 'Your Company Name'
[string]$appName = 'SEP Uninstall'
[string]$appVersion = '1.0'
[string]$appArch = 'x64'
[string]$appLang = 'EN'
[string]$appRevision = '01'
[string]$appScriptVersion = '1.0.0'
[string]$appScriptDate = '01/14/2020'
[string]$appScriptAuthor = 'Mike@FixFlare'
##*===============================================

 
Around line 169 edit the uninstallation settings like below. Replacing Symantec Endpoint Protection with the application you’re trying to uninstall.

Here I’ve configured a custom parameter /QN SYMREBOOT=ReallySuppress I’ve also added the Uninstall for LiveUpdate as well.

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
##*===============================================
##* UNINSTALLATION
##*===============================================
[string]$installPhase = 'Uninstallation'

## Handle Zero-Config MSI Uninstallations
If ($useDefaultMsi) {
	[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Uninstall'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
	Execute-MSI @ExecuteDefaultMSISplat
}

# <Perform Uninstallation tasks here>
Get-InstalledApplication -WildCard 'Symantec Endpoint Protection*' | Where-Object {$_.DisplayName -NotLike '*Manager*'} | ForEach-Object {Execute-MSI -Action Uninstall -Path $_.UninstallSubkey -Parameters '/QN SYMREBOOT=ReallySuppress'}

#LiveUpdate
Get-InstalledApplication -Name 'LiveUpdate 3.3 (Symantec Corporation)' | ForEach-Object {Execute-Process -Path $_.UninstallString.Split('"')[1] -Arguments '-a -s -q -u'}

Creating the Application

General Information

  • Open Configuration Manager Console, go to Software Library > Application Management > Applications
  • Right click the folder where you want to create your application and select “Create Application”
  • Select “Manually specify the application information”
  • Enter Application info making sure to include at least Name and Software Version
SQL Example
Figure 2: Application Wizard - Step 1

Software Center

On the next page, select a language and enter the Localized application name.
Here I’ve also included my own custom icon:

SQL Example
Figure 3: Application Wizard - Step 2

Deployment

On the Deployment Types screen click Add..
For the Type select Script Installer and Manually specify the deployment type information

SQL Example
Figure 4: Application Wizard - Step 3

General Information

On the next screen, enter a name again:

SQL Example
Figure 5: Application Wizard - Step 4

Content

  • Content Location: The UNC path to your Powershell Application Deployment Toolkit files.
  • Installation Program: “Deploy-Application.exe” -DeploymentType “Uninstall”
    • Since we are performing an uninstall we use the same DeploymentType for Install and Uninstall.
  • Uninstall Program: “Deploy-Application.exe” -DeploymentType “Uninstall”
SQL Example
Figure 6: Application Wizard - Step 5

Detection Method

  • Click Add Clause…, change the Setting Type to Windows Installer
  • In the Product code box enter your first GUID and hit OK.
    • Repeat this process for each one of your GUIDs.
SQL Example
Figure 7: Application Wizard - Step 6

User Experience

These settings can be changed to suit your environment but for most setups you’ll want to change these settings:

  • Installation behavior: Install for system
  • Logon requirement: Whether or not a user is logged on
SQL Example
Figure 8: Application Wizard - Step 7

Completing the Wizard

Go ahead and hit Next twice to skip the Requirements and Dependencies screen. They aren’t needed for most deployments.

Finally click Close which should bring you back to the Create Application Wizard screen. To complete the Wizard, click Next two more times and then **Close.

Deploying the Application

Right click your newly created application which should now be showing in the folder you selected and click Deploy

SQL Example
Figure 9: Deployment Wizard - Step 1

Content

Select the distribution points or distribution point groups where you would like the software deployed. This will be specific to your setup so I can’t offer direct guidance here.

Deployment Settings

Since we are Uninstalling rather than Installing it’s important we set the Action here to Uninstall

SQL Example
Figure 10: Deployment Wizard - Step 2

Scheduling

This is pretty self explanatory you can either set it to be available As soon as possible after the available time or schedule it for a later date/time.

SQL Example
Figure 10: Deployment Wizard - Step 3

User Experience

These options are entirely up to you. My organization uses maintenance windows so I’ve opted to hide notifications to the user and not allow _un_installation outside of our maintenance windows.

SQL Example
Figure 11: Deployment Wizard - Step 4

Alerts, Summary, and Completion

Nothing to do here but hit Next until you’ve completed the wizard. If everything went correctly you can speed up a computer’s retrieval of the policy by going to Start > Control Panel > Configuration Manager > Actions tab, select Machine Policy Retrieval & Evaluation Cycle and click Run Now

SQL Example
Figure 12: SCCM Control Panel
Share on

Michael
WRITTEN BY
Michael
IT Engineer