Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / PowerShell / Uninstalling Programs with PowerShell in Windows 10/11

March 17, 2024

Uninstalling Programs with PowerShell in Windows 10/11

In this article, we’ll look at how to uninstall software on a local or remote Windows computer using PowerShell. Quite often, the system administrator uses scripts to uninstall Windows applications. You can use several approaches to remove programs from the command prompt or PowerShell scripts.

Contents:
  • Using WMI to Uninstall Programs in Windows
  • Uninstall Apps on Remote Computer with PowerShell Package Manager Module
  • How to Uninstall App with WinGet Command?

Using WMI to Uninstall Programs in Windows

The most common way to remove installed programs on Windows is to use commands that refer to the WMI namespace. For example, you can query the WMI namespace and get a list of installed programs with the wmic command.

wmic product get name,version

wmic product get name,version - get list of installted appd

To silently uninstall an application from this list, you may use the command below:

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

The command calls an app uninstallation WMI method through the Windows Installer.

Executing (\\COMPName\ROOT\CIMV2:Win32_Product.IdentifyingNumber="{PROGRAM_GUID}",Name="VMware vCenter Converter Standalone",Version="6.2.0.8466193")->Uninstall()

If the program is successfully uninstalled, it will return:

Method execution successful. Out Parameters: instance of __PARAMETERS {
ReturnValue = 0; };

Here are similar PowerShell commands to display and uninstall apps via WMI:

Get-WmiObject Win32_Product | ft name,version,vendor,packagename
(Get-WmiObject Win32_Product -Filter "Name = 'XXX'").Uninstall()

In order to remove a program on a remote computer, add the -ComputerName option. For example, to uninstall Microsoft Office on a remote computer, run the command below:

$apps = Get-WmiObject -Class Win32_Product -ComputerName wkmn-man23 |where name -Like "Office 16 Click-to-Run*"
$apps.uninstall()

However, this method of removing applications is not universal enough for all possible cases. If you compare the list of programs returned via the WMI namespace and the list of apps in the Windows Control Panel/ Apps & features list in Settings (use the MS-Settings quick access command: ms-settings:appsfeatures), you will see that they differ. The wmi command only displayed a list of programs installed through the Windows Installer. The list doesn’t include most user apps (browsers, for example).

full list of instaled programs in windows 10

In addition, UWP programs from the Microsoft Store, and PowerShell modules (via PowerShellGet) are not displayed.

Uninstall Apps on Remote Computer with PowerShell Package Manager Module

In modern Windows 10/11 builds and Windows Server 2022/2019/2016, you can use the built-in PowerShell Package Management cmdlets to install or uninstall apps. Originally, the module was used to install/uninstall PowerShell modules. However, you may use it to uninstall Win32 programs, MSU updates, and apps installed using MSI installers as well.

To display a complete list of installed apps on a local computer, run the command below:

Get-Package

Get-Package - Powershell: Export List of apps

The command returns several classes of programs installed through the different providers (ProviderName). You can display a list of providers on a computer as follows:

Get-PackageProvider

  • Programs
  • Msi
  • Msu
  • PowerShellGet
  • NuGet

list package proveders in windows 10

To show a list of programs installed via a specific provider, run this command:

Get-Package -ProviderName Programs -IncludeWindowsInstaller

Use the Uninstall-Package cmdlet to remove the program:

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

You can remove the installed PowerShell module. For example, to uninstall all VMware.PowerCLI modules:

Get-Package -ProviderName PowerShellGet -Name "VMware.*" | Uninstall-Package

To uninstall a program on a remote computer, use the Invoke-Command cmdlet:

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

You can enable WinRM PowerShell Remoting on domain computers via GPO.

You can use this module to uninstall Win32 apps and PS modules only. To remove UWP apps from Microsoft Store, use the Remove-AppxPackage or Remove-AppxProvisionedPackage PowerShell cmdlets (see an example in this article).

How to Uninstall App with WinGet Command?

You can use the new WinGet package manager (it is built into Windows 10 and 11) to install and remove programs on Windows. To get a list of programs on your computer, run:

winget list

The command returns a list of programs including those installed using other methods than winget and a list of UWP (APPX) apps.

winget list installed apps

To remove apps installed via WinGet, run the command below:

winget uninstall --name 7zip.7zip

To uninstall an MSI app in Windows, specify its GUID:

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

To uninstall a UWP app:

winget uninstall --id "Microsoft.ZuneVideo_8wekyb3d8bbwe"

winget uninstall application from cmd

However, winget doesn’t allow you to uninstall programs on a remote computer. To execute winget command on a remote computer, use the PowerShell Remoting features (Invoke-Command and Enter-PSSession cmdlets). For example:

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

You can use the PowerShell scripts shown here to remotely uninstall programs or run them on domain computers using SCCM or GPO logon scripts.

1 comment
1
Facebook Twitter Google + Pinterest
PowerShellWindows 10Windows 11Windows Server 2019
previous post
Configuring Remote Desktop Services (RDS) Farm on Windows Server
next post
How to Send a Message to Teams Channel with PowerShell

Related Reading

Fix: Remote Desktop Licensing Mode is not Configured

August 24, 2023

Wi-Fi (Internet) Disconnects After Sleep or Hibernation on...

March 15, 2024

How to Install Remote Server Administration Tools (RSAT)...

March 17, 2024

How to Find the Source of Account Lockouts...

March 12, 2024

How to Delete Old User Profiles in Windows

March 15, 2024

Managing Windows Firewall Rules with PowerShell

March 11, 2024

Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)

March 17, 2024

Start Menu or Taskbar Search Not Working in...

April 22, 2025

1 comment

hysi September 23, 2024 - 2:02 pm

awsome,but still i got some problem when i try uninstall some application on my pc.when i try to use
Get-Package -Name “**” | Uninstall-Package,it stuck there for like ten more mins.took that so much time then i shut it down.

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)
  • How to Download Offline Installer (APPX/MSIX) for Microsoft Store App
  • Fix: Remote Desktop Licensing Mode is not Configured
  • How to Delete Old User Profiles in Windows
  • Configuring Port Forwarding in Windows
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top