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
🌐
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.
🌐
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 …
Discussions

How do i uninstall a program using cmd in Recovery?
So i am currently running a windows ... the same problem again so i was wondering if i can fix it simply by uninstalling the program using cmd in recovery. ... Locked Question. This question was migrated from the Microsoft Support Community.... More on learn.microsoft.com
🌐 learn.microsoft.com
3
1
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
Script to uninstall program
If you are on Windows 10 or later, please try this first. Who know, you might get lucky. winget uninstall "Axon Agent" It works from both Command Prompt and PowerShell, if you have the Desktop App Installer not uninstalled. A second trick is to open the legacy PowerShell 5.1 (not PowerShell 6 or later) and run this command: Uninstall-Package -Name 'Package name' In the case you don't know the 'Package name', get it from here: Get-Package | Sort-Object -Property Name In PowerShell, the equivalent of wmic is Invoke-CimInstance. I'm afraid I cannot give you any tips on how to use it, because I'm opposed to using the win32_product class. Here is why: https://sdmsoftware.com/wmi/why-win32_product-is-bad-news/ If none of the above worked, you can call msiexec.exe /uninstall. You can extract the needed parameter from the Windows Registry. More on reddit.com
🌐 r/PowerShell
11
0
August 27, 2024
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
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...

🌐
Virtually Impossible
virtuallyimpossible.co.uk › using-an-elevated-command-prompt-to-open-add-remove-programs
Using an elevated command prompt to open Add Remove Programs - Virtually Impossible
May 30, 2012 - Open the run box (windows key + r) and type runas /user:DOMAINADMIN cmd. You will be prompted for the domain administrator password. Type said password and press enter. Once the elevated command prompt appears, type control appwiz.cpl to open the Add/Remove Programs control panel.
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

🌐
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
Below are reliable methods with exact commands and notes. 1) Using WMIC (works for many MSI and standard installers) Open an elevated Command Prompt: press Win, type cmd, right‑click Command Prompt → Run as administrator.
🌐
EaseUS
easeus.com › pc transfer › how to uninstall a program using cmd [step by step]
How to Uninstall a Program Using CMD [Step by Step]
January 29, 2026 - Open Command Prompt as administrator ... Prompt, type "product get name" and press the Enter key. Run the command "product where name="program name" call uninstall" to delete the unwanted app....
Find elsewhere
🌐
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.
Top answer
1 of 8
21

Every program that properly installs itself according to Microsoft's guidelines makes a registry entry in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall. Usually, the key for the program will be its GUID, or else the name of the program. Within that key will be an entry called UninstallString. This contains the command to execute to uninstall the program.

If you already know ahead of time what you will be uninstalling, it should be easy enough to just put that in your batch file. It gets tricky when you try to automate that process though. You can use the reg command to get data from the registry, but it returns a lot of text around the actual value of a given key, making it hard to use. You may want to experiment with using VBscript or PowerShell, as they have better options for getting data from the registry into a variable.

2 of 8
32

You can invoke the correct uninstaller without knowing the GUID, etc. by using WMIC.

To see a list of the names of the programs as known internally by Windows:

wmic product get name

Look for your product name. It probably matches the one listed in the "Programs and Features" control panel, but not always.

Then you can use

wmic product where name="_my_product_name" call uninstall

to perform the uninstall, which AFAIK should be silent (it has been in my experience, but try it before you bet the farm on that. Silence may depend on how your installer/uninstaller was built).

See here for more:

  • WMIC: the best command line tool you've never used (overview of WMIC with lots of cool commands described)
  • Windows: Uninstall an Application from the Command Line (the specific recipe)

There's also reference documentation for WMIC on microsoft.com.

🌐
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.
🌐
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 - Just replace program name with the name of the program you want to install. For example, if we want to uninstall the iTunes App, we would type this command: ... You'll then be asked to confirm if you really want to execute the command.
🌐
YouTube
youtube.com › watch
How to Uninstall Programs through Command Line - YouTube
This method shows how to uninstall the installed program through command line argument, when traditional method does not work. Many times we get some weird e...
Published   June 20, 2015
🌐
Reddit
reddit.com › r/powershell › script to uninstall program
r/PowerShell on Reddit: Script to uninstall program
August 27, 2024 -

Hello all, Not directly power shell but this is the closest sub I could find that may be able to help. I am trying to uninstall a program and clean up afterwards by deleting the associated folders, but running into issues when combining all the commands as a script.

What I have so far is:

  • @ECHO OFF

  • Net stop tripwireAxonAgent

  • Wmic

  • product where name="Axon Agent" call uninstall /nointeractive

  • Quit <=(here is where I have the issue)

  • RMDIR /s /q "C:\ProgramData \Tripwire\Agent"

  • Pause

My main issue is after the product uninstall via WMIC, it will not exit that prompt and remains inside the subsection for it. I’ve tried “quit” “exit” and CD back to the default c:\windows but any command I enter says “syntax error” and just puts the command to delete the directory on screen and freezes the screen.

If I run the commands by themselves, there is no issue and it completes without a problem.

What am I missing / not doing properly. Any help is appreciated.

Also, for reference, I used WMIC to uninstall the program because the MSI the vendor was telling me to use was consistently giving me errors saying “ a product is already installed. You cannot install this version.” or I would get an error saying “ the product is not installed”

Would it be easier to switch this over to power shell to complete the task? I did not originally use power shell because the vendor said there may be issues when using it.

🌐
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?

🌐
MiniTool
minitool.com › home › news › how to uninstall program using cmd/powershell windows 10/11
How to Uninstall Program Using CMD/PowerShell Windows 10/11 - MiniTool
September 28, 2025 - It can help you quickly remove stubborn programs while optimizing system performance and freeing up more disk space. Exclusive 50% OFF Revo Uninstaller Pro ... Step 1. Press Windows + R, type cmd, and press Ctrl + Shift + Enter to open elevated ...
🌐
Microsoft Support
support.microsoft.com › en-us › windows › uninstall-or-remove-apps-and-programs-in-windows-4b55f974-2cc6-2d2b-d092-5905080eaf98
Uninstall or remove apps and programs in Windows - Microsoft Support
You can try to repair a program first, if it's just not running correctly. ... Select Start > All apps and search for the app in the list shown. Press and hold (or right-click) on the app, then select Uninstall. ... Select Start > Settings > Apps > Installed apps . Find the app you want to remove, select More > Uninstall. Note: Some apps can't be uninstalled from the Settings app right now.
🌐
Alphr
alphr.com › home › how to force a program to uninstall in windows 10 or 11
How to Force a Program to Uninstall in Windows 10 or 11
October 14, 2022 - To uninstall a program or app via Command Prompt, you’ll first need to run Command Prompt as an administrator: In the Windows Search box, type cmd. Select the Command Prompt app. Right-click it, then click Run as administrator. Command Prompt will open with administrator permissions.
🌐
Up & Running Inc
urtech.ca › 2019 › 09 › solved-command-line-to-uninstall-software-exes-or-msis
SOLVED: Command Line To Uninstall Software EXE's or .MSI's - Up & Running Inc - Tech How To's
February 21, 2023 - Figure out what the GUID of the ... Either in a CMD window running as an ADMIN or a script running as an ADMIN msiexec /quiet /norestart /uninstall {<GUID>} like: msiexec /quiet /norestart /uninstall {7FCA6452-46F2-452F-A5A7...