Uninstalling most software on your system is very easy. You can simply go to Programs and Features in the Control Panel or Apps & features in your Settings to uninstall them. However, these programs do not display all the software on your system. What’s more, you can’t uninstall many store apps using such tools.
It makes PowerShell the best option to uninstall any currently installed software from Windows. Moreover, with the new PowerShell core, you can use it on other operating systems as well.
How to Uninstall Software Using PowerShell?
There are different ways to uninstall software depending on the nature or source of the application.
First, open Windows PowerShell using the commands below and then go to the relevant method:
- Open Run by pressing Win + R.
- Type
powershell
and press Ctrl + Shift + Enter to open the Elevated Windows PowerShell. If you wish to use PowerShell core (v6+), you need to use thepwsh
Run command.
You can also go through them and apply the necessary cmdlets on a PowerShell script.
Using Uninstall Method for MSI Installed Software
You can use the uninstall method under Microsoft.PowerShell.Management to uninstall apps that you installed on your computer using a Microsoft Installer (MSI) script.
While you can’t use it to uninstall other apps, such as those that used the EXE installer, it is possible to use it on remote computers in the same network.
Here’s how you can use this method:
- On PowerShell, enter the command
Get-WmiObject -Class Win32_Product | Select-Object -Property Name
to get a list of all software that used the MSI installer. - Then, use the command
$AppToUninstall = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq “Full App Name"}
to assign the PowerShell Management object (software) to a variable $AppToUninstall. Here, you can have any variable name you want but don’t forget that PowerShell uses the ‘$’ sign to denote a variable. - Alternatively, you can use
$AppToUninstall = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -match “Part of App Name"}
. However, there may be more than one software with the same part name, causing the variable to store multiple apps. So you may want to check its value by entering the commandWrite-Output $AppToUninstall
- After assigning the object to the variable, you can call it with the uninstall method by using the command below:
$AppToUninstall.uninstall()
- If you want to uninstall software on a remote computer, you need to attach the attribute
-ComputerName “Remote Computer Name”
on the Get-WmiObject cmdlet. - Then, follow the on-screen instructions.
With Uninstall-Package Cmdlet for Other Software
The above method does not support uninstalling apps that used the PackageManagement module for installation. This is why when you open the Programs and Features on the Control Panel (appwiz.cpl
on Run), you will see more applications on the list.
You need to use the PackageManagement cmdlet Uninstall-Package
to remove these apps. You can also uninstall some apps that used .msi
installer using this cmdlet. Here’s what you need to do:
- On PowerShell, enter the command
Get-Package -Provider Programs -IncludeWindowsInstaller -Name *
to get a list of all installed PackageManagement apps. - Search for the software you wish to uninstall and note down its full name.
- You can also use
Get-Package -Provider Programs -IncludeWindowsInstaller -Name “Full app name”
to get only the necessary applications. Or you can use wildcards if you don’t know the full app name. For instance,Get-Package -Provider Programs -IncludeWindowsInstaller -Name “*Zip*”
- Now, enter
Uninstall-Package -Name “App Name”
to uninstall the app. - Alternatively, you can combine both cmdlets together in the following way:
Get-Package -Provider Programs -IncludeWindowsInstaller -Name “*Zip*” | Uninstall-Package
It is especially useful sinceUninstall-Package
doesn’t take wildcards. - If you have multiple versions of the same application, this command only uninstalls the latest one. So, if you want to specify a certain version, you need to use the
–RequiredVersion “Version”
cmdlet while replacing “Version” with the exact app version.
There are also other attributes you can use with these cmdlets. Since we have only described the necessary and most used ones in this article, we recommend visiting their official documentation to get more information.
Using UninstallString Registry Entry for All Software
The Windows Registry stores Uninstall Strings for all applications. Whenever you uninstall an app through the Control Panel, Settings, or using uninstall commands, your system searches for their corresponding UninstallString registry entry and runs its value.
So, it is possible to uninstall the apps by searching for this value and directly running it. Here’s how you can do so:
- On PowerShell, enter the following command while replacing “Part of the file name” appropriately:
Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Where-Object { $_.DisplayName -match "Part of the file name" } | Select-Object -Property DisplayName, UninstallString
- Copy the UninstallString for the app, paste it on the PowerShell prompt, and press Enter to run the uninstaller. If it is an executable file (.exe), you need to use the command below:
& "Full path of .exe file"
- Then, follow the on-screen instructions.
Through Remove-AppxPackage Cmdlet for Microsoft Store Software
The Universal Windows Platform (UWP) applications you install using the Microsoft Store make use of the Appx module. So, you also have to use this module to uninstall such apps. Here’s how you can do so:
- On PowerShell, enter
Get-AppxPackage -AllUsers
to get a list of all UWP or store apps. - Search for and copy the name of the app (under Name) you want to uninstall.
- Now, enter the cmdlet below to uninstall it:
Remove-AppxPackage - Package “Package Name”.
- Alternatively, you can use
Get-AppxPackage “Package Name” | Remove-AppxPackage
for the same purpose. - You can also use wildcards, such as *, to if you only know part of the name and don’t wish to list out all apps. For example, to uninstall Microsoft Photos, you can type
Get-AppxPackage *Photos* | Remove-AppxPackage
and press Enter.