Powershell

How to Uninstall Software Using PowerShell

You can manage your Windows system and automate operations with the help of the robust utility PowerShell. One of the things you can do with PowerShell is to uninstall software that you no longer need or want.

How to Uninstall Software Using PowerShell

The Uninstall-Package command is the easiest way to uninstall software using PowerShell. It is part of the PackageManagement module that allows you to manage software packages from various sources, such as NuGet, Chocolatey or MSI.

To uninstall a program using the Uninstall-Package command, you need to know the name of the package that corresponds to the program and for that execute:

Get-Package -Provider Programs -IncludeWindowsInstaller

This will display all the packages that are installed on your computer, including those that were installed using Windows Installer (MSI). The -Name argument can also be used to filter the results by a particular name or pattern like for example, if you want to uninstall XAMPP, you can use the following command:

Get-Package -Provider Programs -IncludeWindowsInstaller -Name *XAMPP*

This will display all the packages that have “XAMPP” in their names. You can then use the Uninstall-Package command to remove them one by one or in bulk.

You can use the next command to uninstall the XAMPP program:

Uninstall-Package -Name XAMPP

This will uninstall the package from your computer without any user interaction. You can also use the -Force parameter to suppress any warnings or prompts that may occur during the uninstallation process.

If you have installed two similar programs with different version then in that case you can specify the version of the program along with piping the list of programs command:

Get-Package -Name XAMPP -RequiredVersion  8.0.25-0 | Uninstall-Package

The advantage of using the Uninstall-Package command is that it works for any type of package that is registered with PackageManagement, not just MSI. It also allows you to uninstall multiple packages at once by using wildcards or arrays. However, it may not work for some packages that are hidden or not recognized by PackageManagement.

Conclusion

To uninstall software using PowerShell get the list of programs using the Get-Package cmdlet and then find the program you want to uninstall. Next use the Uninstall-Package command to uninstall a program from Windows using PowerShell and to verify again check the list of installed programs.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.