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:
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:
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:
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:
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.
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.