Blog

This article explains how to uninstall applications on local and remote Windows computers using PowerShell. Automation scripts often require code blocks to remove installed Windows applications. Several approaches can be used to uninstall applications from the command line or PowerShell scripts.

You can purchase Windows 10-11 from our catalog:

Windows 11 – from 11.20 €

Windows 10 – from 9.16 €

Uninstalling Installed Applications Using WMI

The most common method for uninstalling applications in Windows involves commands that interact with the WMI namespace. For example, you can list installed applications using the wmic utility:

wmic product get name,version

To silently uninstall an application from this list, use:

wmic product where name="VMware vCenter Converter Standalone" call uninstall /nointeractive

This command invokes the WMI method to uninstall the application via Windows Installer.

Equivalent PowerShell commands for listing and uninstalling applications via WMI:

Get-WmiObject Win32_Product | ft name,version,vendor,packagename

(Get-WmiObject Win32_Product -Filter "Name = 'XXX'").Uninstall()

To uninstall an application on a remote computer, add the –ComputerName parameter. For example, to remove Microsoft Office from a remote computer:

$apps = Get-WmiObject -Class Win32_Product -ComputerName wks-pc11s22 | where name -Like "Office 16 Click-to-Run*"

$apps.uninstall()

However, this method is not universal. The list of applications retrieved via WMI differs from the list in the Windows Control Panel. WMI only shows applications installed via Windows Installer, excluding user-installed Microsoft Store applications.

Uninstalling Applications on a Remote Computer Using the Package Manager PowerShell Module

In modern versions of Windows 10/11 and Windows Server, you can use cmdlets from the Package Management module to uninstall applications. To list all installed applications, run:

Get-Package

This command returns multiple classes of applications installed via different providers (ProviderName). To list available providers, run:

Get-PackageProvider

– Programs
– Msi
– Msu
– PowerShellGet
– NuGet

To list applications installed via a specific provider:

Get-Package -ProviderName Programs -IncludeWindowsInstaller

To uninstall an application, use the Uninstall-Package cmdlet:

Get-Package -Name "Notepad++*" | Uninstall-Package

To uninstall an application on a remote computer using Invoke-Command:

Invoke-Command -ComputerName Msk-Ser01 -ScriptBlock { Get-Package -Name "Notepad++*" | Uninstall-Package }

Using the WinGet Package Manager to Uninstall Applications

The WinGet package manager allows installing and uninstalling applications in Windows 10/11. To list applications on the computer, run:

winget list

This command returns a list of applications, including those not installed via WinGet, as well as UWP applications.

To uninstall an application, run:

winget uninstall --name 7zip.7zip

To uninstall an MSI application by specifying its GUID:

winget uninstall --id "{332C1E78-1D2F-4A64-B718-68095DC6254B}"

To uninstall a UWP application:

winget uninstall --id "Microsoft.ZuneVideo_8wekyb3d8bbwe"

However, WinGet does not support uninstalling applications on remote computers directly. To run WinGet commands on a remote computer, use PowerShell Remoting (cmdlets like Invoke-Command or Enter-PSSession). For example:

Invoke-Command -ComputerName pc2122sd1 -ScriptBlock {winget uninstall --name 7zip.7zip}

These commands and scripts can be used to automate the uninstallation of applications on both local and remote computers, streamlining administrative tasks in Windows environments.

banner for Windows
Buy Windows от product key from
8.00 € Find Out More
Subscribe
Notify of
guest
0 comments
Newest
Oldest
Inline Feedbacks
View all comments