In this blog post, we will explore multiple ways to uninstall Windows applications from Intune-managed devices. Some uninstallation methods depend on how the application was initially installed. For example, if you used Intune to deploy an MSI application, it is easier to uninstall it by simply using the Uninstall assignment section of the app deployment.
For Win32 app based deployment, Uninstall command needs to be provided which will run when a group is in the Uninstall assignment section of the app deployment. Let’s explore the various methods for uninstalling different types of windows applications.
Contents
Uninstall MSI based Applications
MSI-based applications are easy to manage in terms of installations and uninstallations. Therefore, we will start with this simplest application type and then move on to other formats, such as .exe or Microsoft Store apps.
Option 1: Using Uninstall Assignment Section
- Sign in to the Intune admin center > Apps > All Apps. Open MSI based line-of-business app.
- Go to Properties > Click on Edit next to Assignments.
- To uninstall the application, add a group in the Uninstall section. Ensure that the same user or device is not a part of the group which has been added to the Required section.
- Wait for the next Intune device check-in, which will remove the app automatically.
Option 2: Using Win32 App Uninstall Command
You can also use the Win32 app deployment method to deploy MSI applications. This method is generally used for deploying complex MSI apps. For simpler MSI-based apps, the line-of-business app method is preferred. For more information, refer to this link: Deploy MSI using Intune Win32 App Method.
To uninstall an MSI app deployed using the Win32 app method, you can use the UninstallString and provide it as the uninstall command in the Win32 app deployment. You can find the UninstallString for any installed MSI app in the following registry locations:
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
- HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
For example: For Apache Open Office app, UninstallString is: MsiExec.exe /X{E9F3BF94-AA18-42B6-8B6D-245BBF585C8C} /qn.
Option 3: Using a PowerShell Script
You can deploy a PowerShell script to uninstall an application from Intune-managed Windows devices. For uninstalling an MSI-based application, the best approach is to install the same version of the application on a test device and retrieve the UninstallString from the Registry Editor. As already mentioned this in the previous section, You can find UninstallString at below registry locations:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
Below screenshot shows an example of the UninstallString value for an application called eSigner. You can double-click on UninstallString and copy the value Msiexec.exe /X{Product Code}
. If you open the Command Prompt as an administrator on a device where this application is installed and execute this command, it will uninstall the application. Therefore, we will use this value to create a PowerShell script.
To summarize, for Uninstalling an MSI based application using a PowerShell script.
- Install MSI based application on a test device.
- Go to the registry locations given above and Copy the UninstallString value.
- Create a PowerShell script using below line of code (replace the product code with the one you copied)
Below example script can be used to Uninstall a single MSI application as it contains only one product code.
Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x {Product Code} /quiet /noreboot" -Wait -NoNewWindow
Uninstall.ps1
Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x {167F8EE9-83CE-471C-A7D1-BC777F0A8638} /quiet /noreboot" -Wait -NoNewWindow
Below example script can be used to Uninstall multiple MSI based application from target Windows devices. Replace the product code values with the application you want to remove.
UninstallMultipleApps.ps1
Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x {167F8EE9-83CE-471C-A7D1-BC777F0A8638} /quiet /noreboot" -Wait -NoNewWindow
Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x {3a06e0d8-7b7c-4044-bf75-2817fd4384aa} /quiet /noreboot" -Wait -NoNewWindow
Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x {ABBA3283-FE97-4223-BE77-281D85A8CB6D} /quiet /noreboot" -Wait -NoNewWindow
Uninstall EXE Applications
We have explored different methods to uninstall MSI-based applications from Intune-managed Windows devices. Now, we will look at the options available to uninstall applications deployed using an EXE installer.
As discussed earlier, the line-of-business app deployment method is preferable for installing MSI-based applications. However, for EXE-based applications, the line-of-business method cannot be used—you must use the Win32 app deployment method.
When creating a Win32 app deployment for an EXE application, you need to provide the Install command and Uninstall command under the Program tab.
If you assign the application under the Required section, the Install command will be executed on the target device to install the application. If you assign the application under the Uninstall assignment section, the Uninstall command will be executed to uninstall the application. Therefore, ensure that the same device is not included in both the Required and Uninstall sections.
Uninstall command silently uninstalls the application from the device without any user interaction. Some application vendors provide an uninstall command in the application documentation. While some switches can be found from the command line. For guidance on how to find application installer switches, refer to the blog post: Find Silent Install Switches of any EXE or MSI.
- Sign in to the Intune admin center > Apps > All Apps. Open Win32 based app > Properties > Click on Edit next to Assignments.
- Go to the Program tab and ensure that Uninstall command is populated. (It’s a best practice to test the Uninstallation of the app using the command being provided in the Uninstall command box, this will reduce the chance of failures).
Below is an example of an Uninstall command that executes a PowerShell script. This PowerShell script contains the code to uninstall the application. Therefore, test the script manually on a device to ensure it successfully uninstalls the application before using it in the Intune deployment.
Let’s take the example of the Notepad++ application. When you install this application on a device, it provides uninstall.exe for uninstalling the app. If you use it with the /S
switch, it will uninstall silently. The silent switches can be found in the Notepad++ Online User Manual. Scroll down on the linked page to locate the Installer Options section, which provides the /S switch for silent installation. Please ensure that it’s an uppercase “S”, not lowercase.
Let’s take another example, the Citrix Workspace app. I have created a Win32 app deployment for this app and provided the uninstall command as CitrixWorkspaceApp.exe /silent /uninstall. You can search for the silent uninstall switches in the Citrix documentation or the application-specific documentation available on the Citrix website.
- After you have provided the Uninstall command, Go to the Requirements tab and add a group in the Uninstall assignment section. Ensure that the same user or device is not a part of the group which has been added to the Required section.
Uninstall Microsoft Store Applications
If you have initially deploy an application using Microsoft store app deployment method. It’s easy to uninstall it from Intune-managed Windows devices.
- Sign in to the Intune admin center > Apps > All Apps. Open Microsoft store based application.
- Go to Properties > Click on Edit next to Assignments.
- To uninstall the application, add a group in the Uninstall section. Ensure that the same user or device is not a part of the group which has been added to the Required section.
Again, as discussed already, any application can be uninstalled using a PowerShell script which contains the necessary code to uninstall the app. Ensure that the script is tested manually on a test device to confirm if it’s working fine, and then Sign in to the Intune admin center > Devices > Scripts and Remediations > Platform Scripts to deploy the script.
For Step-by-step guide on deploying a PowerShell script using Intune, refer to below blog post: