I need to use a script with either CMD or Power Shell to uninstall a program from a windows machine.

To be clear , I already know how to use the “wmic” & "Get-WmiObject -Class Win32_Product ", what I am looking for is how to remove the programs listed under Programs & Feature in control panel but doesn’t show up when using WMIC (Product Get Name) or (Get-WmiObject -Class Win32_Product) commands.

I can use these script easily:

1. CMD:

wmic

product get name

product where name=“program name” call uninstall

2. Power Shell:

$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match “Software Name” } >> $app.Uninstall()

Both scripts above helped me remove specific programs only, but the list I have under control panel still have lots of other applications that I am hoping to use similar script to remove them.

Any idea / suggestion is highly appreciated ?

Answer from awsayad on community.spiceworks.com
Top answer
1 of 13
12

I need to use a script with either CMD or Power Shell to uninstall a program from a windows machine.

To be clear , I already know how to use the “wmic” & "Get-WmiObject -Class Win32_Product ", what I am looking for is how to remove the programs listed under Programs & Feature in control panel but doesn’t show up when using WMIC (Product Get Name) or (Get-WmiObject -Class Win32_Product) commands.

I can use these script easily:

1. CMD:

wmic

product get name

product where name=“program name” call uninstall

2. Power Shell:

$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match “Software Name” } >> $app.Uninstall()

Both scripts above helped me remove specific programs only, but the list I have under control panel still have lots of other applications that I am hoping to use similar script to remove them.

Any idea / suggestion is highly appreciated ?

2 of 13
3

If the application was installed by MSI, and if you know the GUID, you can use msiexec to uninstall the application. That is the most efficient way, provided that the prerequisites are true.

Win32_Product is very inefficient.

Scripting Blog [archived] – 13 Nov 11

Use PowerShell to Quickly Find Installed Software - Scripting Blog [archived]

Summary: Learn how to use Windows PowerShell to quickly find installed software on local and remote computers.   Microsoft Scripting Guy Ed Wilson here. Guest Blogger Weekend concludes with Marc Carter. The Scripting Wife and I were lucky enough...

Scripting Blog [archived] – 14 Dec 11

Use PowerShell to Find and Uninstall Software - Scripting Blog [archived]

Summary: Learn how to use Windows PowerShell to get software installation locations, and to uninstall software from remote computers. Hey, Scripting Guy! We have a dumb application that we have to use at work. The company has released a new version...

Discussions

Windows 10: How can you uninstall a program when the command prompt is blocked?
Check the PowerPDF support site (if any) and see if there's a command to uninstall from the CLI. It might require using MSIEXEC or knowing the registry entry which identifies the program. But if it can be uninstalled in such a manner, run the command prompt with Admin privileges, then execute the required command. A quick google search found this: https://nuance.custhelp.com/app/answers/detail/a_id/27831/~/how-to-do-a-silent-uninstall-of-power-pdf%3F YMMV More on reddit.com
🌐 r/sysadmin
9
0
May 7, 2023
Uninstall software remotely using the command line - Software & Applications - Spiceworks Community
In this manual, I will show how you can uninstall software remotely from your computer using the command line (and not delete files, but uninstall the program), without going into the control panel and running the Programs and Features applet. I do not know how much this will be useful to most ... More on community.spiceworks.com
🌐 community.spiceworks.com
26
February 11, 2019
I am unable to open Add/remove programs in the control panel, all other bits in the control panel can be opened.
Add/remove programs. I am unable to open Add/remove programs in the control panel, all other bits in the control panel can be opened. Any ideas? Thanks. original title: Add/remove programs. More on learn.microsoft.com
🌐 learn.microsoft.com
4
9
October 9, 2011
Uninstall program through CMD?
It depends on what the application is and how its installer worked. Two ideas: Try booting into safe mode and running the uninstall. Try locating the applications uninstall string. https://webcache.googleusercontent.com/search?q=cache:Hgt00bsF9BQJ:https://www.thewindowsclub.com/a-third-way-to-uninstall-programs-in-windows+&cd=5&hl=en&ct=clnk&gl=us&client=firefox-b-1-d If it refuses to be removed. Boot into safe mode. Deny all permissions to the folder. Reboot into safe mode. Take ownership of the folder and delete it. Remove it from the Add/Remove program listing via: https://www.bleepingcomputer.com/tutorials/manually-remove-programs-from-add-remove-programs/ More on reddit.com
🌐 r/Windows10
3
3
September 1, 2020
🌐
Webroot
answers.webroot.com › Webroot › ukp.aspx
Appwiz.cpl explanation
Appwiz.cpl is a run command shortcut to open the Add/Remove Programs or Uninstall a Program list on Microsoft Windows XP, Vista, 7, 8, and 10. To use the appwiz.cpl command on your computer, press the Windows Key ( ) + R on your keyboard at the same time. The Run Command window should come up.
🌐
Reddit
reddit.com › r/sysadmin › windows 10: how can you uninstall a program when the command prompt is blocked?
r/sysadmin on Reddit: Windows 10: How can you uninstall a program when the command prompt is blocked?
May 7, 2023 -

On one of my client PCs, I had something called PowerPDF installed. I opened up my command prompt as Administrator, typed in appwiz.cpl to open up the Programs list. I then selected PowerPDF, then Uninstall/Change. At that moment, a command prompt window popped up telling me that access is denied.

A bit about our setup with respect to the issue...

Command prompt can be searched for in the Windows search bar. It will also display the opens Open, Run as Administrator nd Open File Location. If a user clicks 'Open', the command prompt will run, but show an access denied message. If 'Run as Administrator' is selected, the user is prompted for a Username and Password, which must be the Admin user.

I'm going to guess what's going on, is that the Uninstall script of the app is just attempting to run Command Prompt without Administrative Privileges, thus the uninstaller is getting blocked. How it got installed in the first place is beyond me.

Anyways, how can I uninstall an app with this problem?

🌐
Windows Command Line
windows-commandline.com › run-command-for-add-or-remove-programs
Run command for add or remove programs
September 21, 2016 - Using Add or remove programs wizard we can install new features of the Windows(which are not installed by default) and also uninstall programs that are no longer needed. We can open this wizard from Run window by running the command appwiz.cpl
🌐
Computer Hope
computerhope.com › issues › ch002272.htm
How to Uninstall a Program Using Command Prompt.
September 7, 2025 - Learn how to uninstall programs using the Command Prompt on your Windows computer with detailed, instructions that ensure easy removal of unnecessary software.
🌐
GeeksforGeeks
geeksforgeeks.org › techtips › how-to-uninstall-software-via-cmd
How to Uninstall Software via CMD: Top 3 Methods - GeeksforGeeks
December 5, 2025 - Uninstalling programs through Command Prompt (CMD) can be extremely useful especially when the Settings app won’t open, the program won’t uninstall normally, or you need an automated/scripted solution. This guide explains the simplest CMD-based methods to remove software from Windows 10 and 11.
Find elsewhere
🌐
How-To Geek
howtogeek.com › home › windows › how to uninstall a program on windows 10 from command prompt
How to Uninstall a Program on Windows 10 from Command Prompt
August 31, 2023 - Command Prompt will now launch with administrator permissions. To uninstall a program using Command Prompt, you have to use the Windows Management Instrumentation Command-line (WMIC) software utility.
🌐
Spiceworks
community.spiceworks.com › software & applications
Uninstall software remotely using the command line - Software & Applications - Spiceworks Community
February 11, 2019 - In this manual, I will show how you can uninstall software remotely from your computer using the command line (and not delete files, but uninstall the program), without going into the control panel and running the Programs and Features applet. I do not know how much this will be useful to most ...
🌐
EaseUS
easeus.com › pc transfer › how to uninstall a program using cmd [step by step]
Uninstall a Program Using Command Prompt in Windows 11/10
January 29, 2026 - Step 4. Type wmic product where name="Program Name" call uninstall and press Enter. Typically, unwanted programs are uninstalled using the Add or Remove Programs utility or the Settings app in Windows.
Top answer
1 of 6
32

You can get some clues as to where an application lives, by looking at where it's uninstaller is located.

Windows stores the list of uninstaller locations in the registry. You can use Regedit to go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall.

That registry key contains a whole lot of sub-keys with GUID names (big long strings of seemingly random letters and numbers). Use Regedit's search function and set it to look for the name of your program as it appears in the "programs and features" list of installed programs. (Un-tick keys and values and just leave data ticked).

Once you find the right sub-key, you'll see a bunch of values for your program. One of them will be called "UninstallString" and may point to the executable or DLL that is used to uninstall the software (or might pass a file location as a parameter to MSIexec or RunDLL). Depending on where the application's uninstaller lives, that information might give you the clue you need to find the rest of the application.

There are other bits of information in the registry that can help you too - See more info from Microsoft at https://msdn.microsoft.com/en-us/library/aa372105(v=vs.85).aspx

Typically programs that don't list an install location will have installed themselves in a number of places around your disk though, so it's best to use the uninstaller if you can.

2 of 6
17

Go to control panel --> Right click on the Control panel grid header --> Select More --> and check the location option.

Now the program location shows up in the control panel.

Top answer
1 of 2
7

It looks like this can be done from the wmic command
Try this:

wmic product  

Shows a list of everything installed on the computer
Sources:
http://www.sepago.de/d/helge/2010/01/14/how-to-list-all-installed-applications-from-the-command-line http://technet.microsoft.com/en-us/library/bb742610.aspx#ECAA

This page says it's for Windows Vista and 7, but I have tested wmic on Windows XP as well
Get list of installed applications from Windows command line

Also, this page explains that the method of checking the registry entry may not be accurate
http://community.spiceworks.com/how_to/show/2238-how-add-remove-programs-works

Here is some more information on what else can be done using wmic:
http://betanews.com/2011/01/14/wmic-the-best-command-line-tool-you-ve-never-used/
From this website, specifically for your problem:

The program can also provide details on many other aspects of your system. Commands like:

wmic product list brief

wmic service list brief

wmic process list brief

wmic startup list brief

will list your installed software, services, running processes and Windows startup programs, for instance.

2 of 2
1

I don't think you'll be satisfied with any of the cmd approaches as they will not be complete. If you're okay with Powershell, then this gave me everything:

If (!([Diagnostics.Process]::GetCurrentProcess(). Path -match '\\syswow64\\')) {
    $unistallPath = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
    $unistallWow6432Path = "\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
    
    @( 
        if (Test-Path "HKLM:$unistallWow6432Path" ) { Get-ChildItem "HKLM:$unistallWow6432Path"} 
        if (Test-Path "HKLM:$unistallPath" ) { Get-ChildItem "HKLM:$unistallPath" } 
        if (Test-Path "HKCU:$unistallWow6432Path") { Get-ChildItem "HKCU:$unistallWow6432Path"} 
        if (Test-Path "HKCU:$unistallPath" ) { Get-ChildItem "HKCU:$unistallPath" } 
    ) | 
    ForEach-Object { Get-ItemProperty $_.PSPath } | 
    Where-Object { 
        $_.DisplayName -and !$_.SystemComponent -and !$_.ReleaseType -and !$_.ParentKeyName -and ($_.UninstallString -or $_.NoRemove) 
    } | 
    Sort-Object DisplayName | 
    Select-Object DisplayName
} else {
    "You are running 32-bit Powershell on 64-bit system. Please run 64-bit Powershell instead." | 
    Write-Host -ForegroundColor Red
}

🌐
Medium
medium.com › @andrew.perfiliev › how-to-uninstall-program-using-cmd-60911c0eee80
How to uninstall program using CMD | by Andrew Perfiliev | Medium
September 8, 2019 - How to uninstall program using CMD 1. You need to open CMD. Win button ->type CMD->enter 2. type in wmic 3. Type in product get name and press Enter. This will show all of the programs that are …
Top answer
1 of 2
8

Is there any particular reason you're trying to do this from the command-line as opposed to built-in features available in the UI? Also, might there be a system policy that's preventing you from performing these operations?

Here's a suggestion using the UI:

  1. Open the Start Menu
  2. In the Search Bar, type appwiz.cpl.
  3. Wait for appwiz.cpl to appear in the search results. There should be only one entry at the top, under "Programs". It should have a document icon with some gears on it, and should be automatically highlighted.
  4. With appwiz.cpl highlighted in the search results, press CTRL+SHIFT+ENTER. This will force Windows to attempt executing appwiz.cpl with Administrator privileges.
  5. Respond to any UAC prompts as appropriate.

If the above does not work, there may be an issue with your system's Security Policy. Do the following to check:

  1. Log into the system under an account that has Administrator permissions.
  2. Press Win+R.
  3. Type secpol.msc and hit ENTER.
  4. Respond to any UAC prompts as appropriate.
  5. In the left pane, navigate the tree to the following location:

    Security Settings\Local Policies\Security Options

  6. Find the "User Account Control" options, near the bottom of the list.
  7. Check the setting User Account Control: Behavior of the elevation prompt for standard users
    • If it is set to Automatically deny elevation requests, you will not be able to use Administrator permissions while running under a standard user account.
    • If this is set to any of the Prompt for credentials... settings, and the above process for running appwiz.cpl elevated still does not work for you, then you may have a different problem.
2 of 2
5

For whatever reason, the control panel applets inherit the privileges of the running Desktop shell (which is the Windows equivalent of a window manager). To escalate permissions in the control panel, you have to escalate permissions in this shell, via these steps:

  1. Open a command prompt as an administrative user
  2. Kill the running explorer process
    1. Ctl+Shift+Esc Open task manager, and navigate to the processes tab
    2. Find the explorer.exe process(es), and kill all of them. (Right-click, choose End Process) Your taskbar, desktop, and explorer windows will all disappear, but your command prompt will remain
  3. From that admin command prompt, run explorer.exe
  4. Now, you should be able to open appwiz.cpl, or any other control panel applet with administrative privileges.
  5. When you're done, kill the running explorer process(es), and run explorer.exe as the logged-in user.

Caveat: This can lose certain settings, or break your normal desktop environment. For instance, any network paths which have been mounted to a drive will be lost.

🌐
Reddit
reddit.com › r/sysadmin › running programs and features as admin / windows 10
r/sysadmin on Reddit: Running programs and features as admin / windows 10
June 18, 2020 -

Hey,

Seeing as non-administrators aren't allowed to uninstall programs, how would you 'run as' the programs & features applet?

Running appwiz.cpl from an elevated cmd prompt doesn't work. The only method that seemingly does it killing explorer.exe and running it again as an admin user, this breaks network drive mappings and causes other undesirable effects.

I could simply log the user off and log in with an admin account to uninstall the program, but this just seems so long winded.

Are there any other, easier solutions?

Thank You

🌐
Quora
quora.com › How-do-I-uninstall-a-program-on-Windows-10-from-the-command-prompt
How to uninstall a program on Windows 10 from the command prompt - Quora
Step-7: Type ‘product where name="ABC" call uninstall’ and replace ABC with the program you wish to remove and press Enter: ... Step-1: Click on the Start menu and type cmd. Step-2: When the command prompt option appears, click on Run as administrator.
Top answer
1 of 3
2

Hi IIIGeneralII

This problem has been solved by me, i just forgot that the support ticket is still active :b

You can uninstall the program by breaking it, simply use the following command in the recovery cmd

cd C:

Note: depending on which drive you install windows on, it might be D: or something else

cd Program Files

After that use dir to locate the avast file

If you didn’t find it use cd program files (x86) instead

Note its important to check on ehich folder did avast install on

Search on the internet and find out

After that

del avast

It will say “are you sure? (Y/N)?”

Type y and enter

Use cd avast to make sure that all files are deleted

Then use dir

If not all of them are deleted

Use del (something like avast.exe and etc) on all of the files.

Restart your PC/laptop and boot into it

For driver issues and boot looping

Check other topics on them

2 of 3
1

system restore does not work in my case and when trying to use wmic, product returns an invalid class error. Neither of these are a solution for me.

The issue is trying to download avast, the driver files were corrupted causing the BSOD. It is now in a boot loop and the repair nor the system restore will work. They return errors. Checking the logs, they point back to AVAST files. Now I am trying to just remove AVAST since this all happened when I started to download it and the corrupted files all seem to be due to AVAST. I figured the easiest thing should have been to uninstall via the CMD, but wmic does not work as when I type product or product get name, it returns

Node - MININT-JBIHR0D

ERROR:

Description - Invalid class