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

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

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
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
How do i uninstall a program using cmd in Recovery?
So i am currently running a windows server for some purposes, and when i last time booted the computer, suddenly the mouse and keyboard are no longer to be working, so i thought that there is a program i downloaded it before it happened, so i cannot boot… More on learn.microsoft.com
🌐 learn.microsoft.com
3
1
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
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › techtips › how-to-uninstall-software-via-cmd
How to Uninstall Software via CMD: Top 3 Methods - GeeksforGeeks
December 5, 2025 - ... If the app was installed using Winget, you can remove it quickly with a simple command. Right-click the Start button → Command Prompt (Admin). ... If Chocolatey was used to install programs, it can also remove them.
🌐
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 ...
🌐
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 - You can also right-click on the title bar of PowerShell utility and select Edit -> Find, type a part of the app name and click Find Next until you find the target app. Step 3. Next, type the command Remove-AppxPackage <App Name>, e.g.
🌐
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?

Find elsewhere
🌐
MakeUseOf
makeuseof.com › home › windows › 11 different ways to uninstall software in windows 11
11 Different Ways to Uninstall Software in Windows 11
November 2, 2023 - If you prefer command-line methods, you can uninstall software with Command Prompt’s WMIC tool as follows. Click the search button (magnifying glass icon) on Windows 11’s taskbar button. Enter Command Prompt to find that app. Select the Run as administrator option for the Command Prompt search result.
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows › package-manager › winget › uninstall
uninstall Command | Microsoft Learn
To avoid Microsoft Store agreement prompts when uninstalling, you can add the --source winget WinGet flag to the winget uninstall command. Alternatively, you can uninstall using Start > Settings > Apps > Apps & features, finding the app you ...
🌐
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.
🌐
Computer Hope
computerhope.com › issues › ch002272.htm
How to Uninstall a Program Using Command Prompt.
September 7, 2025 - ... You can also right-click the Command Prompt program in the search results and select Run as administrator in the pop-up menu. In an elevated Command Prompt, type wmic and press Enter. You'll see a line that reads wmic:root/cli>.
🌐
Dell
dell.com › support › kbdoc › en-us › 000137586 › windows-10-various-methods-to-uninstall-problematic-programs-and-apps
How To Remove Applications, Programs, and Updates in Windows 11, and Windows 10 | Dell US
However, this does remove any other programs that are installed in that same period. You can find out more on the following link: ... You can right-click the App icon in the Start Menu and select uninstall. However, if this is not available or does not work, you can also use Command Prompt or PowerShell which are Command-Line Interfaces (CLI).
🌐
GeeksforGeeks
geeksforgeeks.org › techtips › how-to-uninstall-an-app-on-windows
How to Uninstall an Application on Windows 11? GeeksforGeeks - GeeksforGeeks
December 5, 2025 - This method offers a quick way to uninstall apps without navigating through graphical interfaces. ... Open Command Prompt as Administrator. Type: wmic and press Enter. Type: product get name to list installed programs.
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.

🌐
Geek Rewind
geekrewind.com › home › windows › uninstall programs in windows 11 via command prompt
Uninstall Programs in Windows 11 via Command Prompt - Geek Rewind
May 6, 2025 - This article explains how to uninstall or remove programs from Windows 11 using the command prompt. Windows allows users to uninstall programs using the Control…
🌐
Pureinfotech
pureinfotech.com › home › how to uninstall apps on windows 11
How to uninstall apps on Windows 11 - Pureinfotech
January 19, 2026 - Alternatively, you can use the “winget uninstall –id APP-ID” command with Command Prompt or the “Get-AppxPackage PROGRAM-NAME | Remove-AppxPackage” command on PowerShell, among other options.
🌐
MiniTool Partition Wizard
partitionwizard.com › home › partition magic › top 7 effective ways to uninstall programs/apps on windows 11
Top 7 Effective Ways to Uninstall Programs/Apps on Windows 11 - MiniTool Partition Wizard
July 11, 2023 - Step 3: Find and right-click on the program in the list, and then click Uninstall. Then confirm and finish the uninstallation. You can also delete apps on Windows 11 through some command lines. Open Command Prompt and type & execute commands to remove the apps.
🌐
The Windows Club
thewindowsclub.com › the windows club › how to uninstall a program using command prompt in windows 11
How to uninstall a program using Command Prompt in Windows 11
January 4, 2025 - The list of all the programs that were installed using Windows Installer will be visible on the Command Prompt interface, just like it is visible in the above screenshot. Now uninstall the program. The command will become: product where name="name-of-the-program" call uninstall · Here, replace the name-of-the-program with its actual name. For example, if you have installed Paint.NET on your PC and want to remove it, then look for its name in that list, and add that name as it is.
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