How to uninstall software using Package management in PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

There are mainly 3 methods by which you can uninstall software using PowerShell.

  • WMI Method.

  • Using Package provider

  • Uninstallation String.

Here, we will discuss the method to uninstall software using Package management.

You can uninstall the software or packages which are installed with the package providers. You can get the list of the package providers using Get-PackageProvider command.

PS C:\Users\Administrator> Get-PackageProvider | Select Name, Version
Name          Version
----          -------

So the packages which are installed with msi, msu, Programs and PowerShellGet can be uninstalled with Uninstall-Package command.

Get-Package -Name 'Vmware tools' | ft -AutoSize

If the package exists, you can get the details of the package. In the below example, there is a package version, Source path, and the Provider Name retrieved.

Name       Version                Source                                     ProviderName
----       -------                ------                                     ------------
VMware    Tools    C:\Program Files\VMware\VMware Tools\ msi

To uninstall a package or software, you can pipeline Uninstall-Package command or directly run the command providing the package name.

Get-Package -Name 'Vmware tools' | Uninstall-Package


Uninstall-Package -Name 'Vmware tools' -Force

Force command is to run command forcefully without asking user permission.

Published on 08-Aug-2020 11:14:15