Uninstall an Application using PowerShell and Endpoint Manager
How to silent uninstall an MSI application using msiexec with PowerShell then use Endpoint manager to deploy the script to a group of computers.
The first part of this article covers how to silent install and uninstall applications from the command line using msiexec from both command prompt and PowerShell. Once we have a working PowerShell script to uninstall the application, we can use Endpoint manager to deploy the script to a group of computers.
This example is for uninstalling Nitro Pro PDF Editor v12, but the steps will be the same for removing any MSI based application using a PowerShell script with Endpoint Manager.
Table of Contents
Install and uninstall MSI applications using msiexec
msiexec can be used to manage applications using Windows Installer from the command line
msiexec options
/i install
/qn quiet, no user interface
/x uninstall
Example: silent install Nitro Pro using a transforms .mst filemsiexec /i "C:\Temp\nitro_pro12_x64.msi" TRANSFORMS="C:\Temp\nitro_pro12_x64.mst" /qn
Example: silent uninstall Nitro Promsiexec /x [installation id] /qn
Get application product ID using PowerShell
To uninstall the application, we will need to get the application product ID or product GUID using PowerShell
# Get name "Nitro Pro" Get-CimInstance -Class Win32_Product | Where-Object Name -eq "Nitro Pro" | fl # Get name using wildcard * Get-CimInstance -Class Win32_Product | Where-Object Name -like "*Nitro*" | fl
# Get all applications Get-CimInstance -Class Win32_Product | ft -autosize
Silent uninstall an application using msiexec (Command prompt)
Example: Silent uninstall Nitro Pro PDF v12 using msiexec from the Command prompt
msiexec /x E7379322-0E5B-4410-A006-91CE28BE652B /qn
Silent uninstall an application using msiexec (PowerShell)
To run msiexec using PowerShell, we will need to use Start-Process and -Argument for the options
Example: Silent uninstall Nitro Pro PDF v12 using msiexec from PowerShell
Start-Process msiexec.exe -Argument "/x {E7379322-0E5B-4410-A006-91CE28BE652B} /qn"
Uninstall an application using an Endpoint Manager script
Create a device group for deployment
Logon to Endpoint Manager admin center
https://endpoint.microsoft.com
Groups - new group
Group type: Security
Group name: Nitro Pro 12 Uninstall
Membership type: Assigned
Create
Deploy PowerShell uninstall script
Devices - Scripts
Add - Windows 10 and later
Name: Nitro Pro 12 Uninstall
Browse for the PowerShell uninstall script
Leave the script settings as the defaults.
# nitro-pro-12-uninstall.ps1 # uninstall Nitro Pro 12 using PowerShell Start-Process msiexec.exe -Argument "/x {E7379322-0E5B-4410-A006-91CE28BE652B} /qn"
Assign the script to the device deployment group we created
Included groups - Add groups
Select the group "Nitro Pro 12 Uninstall"
Assignments - Click Next
Review the changes, then click Add
Check the status of script deployment
Check script deployment from the Endpoint Management admin center
Devices - Scripts - Nitro Pro 12 Uninstall
You can see the number of devices that have run the script successfully and any with errors
Check script deployment on the client computer
On the client computer, you can check the Intune Management Extension logs in this folder
C:\ProgramData\Microsoft\IntuneManagementExtension\Logs
Open the log file IntuneManagementExtension.log and filter for PowerShell
You will see log messages showing the PowerShell script being run on the client
You will also see success or failure messages
References:
msiexec
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/msiexecWorking with Software Installations
https://docs.microsoft.com/en-us/powershell/scripting/samples/working-with-software-installationsNitro Deployment Guide
by Author
https://cdn.gonitro.com/express/documents/product/Nitro_Pro_Deployment_Guide_v13_June+2020.pdf
Comments