Javascript required
Skip to content Skip to sidebar Skip to footer

How to Uninstall a Program Using Cmd in Windows 10

  1. Home
  2. Windows
  3. General Windows

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 ?


Popular Topics in General Windows
Which of the following retains the information it's storing when the system power is turned off?
  • ROM
  • CPU
  • RAM
  • GPU
88% of IT pros got this right.

12 Replies

Evan7191

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.

https://devblogs.microsoft.com/scripting/use-powershell-to-quickly-find-installed-software/

https://devblogs.microsoft.com/scripting/use-powershell-to-find-and-uninstall-software/

Big Green Man
Big Green Man This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Feb 28, 2019 at 21:38 UTC

Evan7191 wrote:

Win32_Product is very inefficient.

More info on that:

https://gregramsey.net/2012/02/20/win32_product-is-evil/

I echo everything Evan said.

awsayad
awsayad This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Feb 28, 2019 at 22:03 UTC

I tried the code as explained in this KB: https://devblogs.microsoft.com/scripting/use-powershell-to-quickly-find-installed-software/ " to no avail, still cannot get all programs but the one with msi installer !

Evan7191

awsayad wrote:

I tried the code as explained in this KB: https://devblogs.microsoft.com/scripting/use-powershell-to-quickly-find-installed-software/ " to no avail, still cannot get all programs but the one with msi installer !

Can you provide an example of some of the applications that you want to uninstall?

Evan7191

awsayad wrote:

I tried the code as explained in this KB: https://devblogs.microsoft.com/scripting/use-powershell-to-quickly-find-installed-software/ " to no avail, still cannot get all programs but the one with msi installer !

Also, most of the code in that link is about listing installed software rather than removing it.  I posted it as evidence that Win32_Product is inefficient.

The second link that I posted has more examples for uninstalling software.  Here it is again:

https://devblogs.microsoft.com/scripting/use-powershell-to-find-and-uninstall-software/

awsayad
awsayad This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Feb 28, 2019 at 22:10 UTC

The ones I was testing on were: WireShark 2.4.12 64 bit, TreeSize Free V4.2.2 and NotePad++ (32-bit x86)

awsayad
awsayad This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Feb 28, 2019 at 22:13 UTC

yes, I am aware of that, I was hoping if I can get a list of these applications then I can actually remove them using the script but they still not showing up. try install TreeSize or WireShark and see if the code listed will return these application !

jackofalltech
jackofalltech This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Mar 1, 2019 at 13:27 UTC

I'm reg edit browse to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall.

Find the key the contains the software you want to uninstall

There will be a value for the uninstall string that is what you run

BravesB
BravesB This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Mar 1, 2019 at 13:29 UTC
This is an oldie but a goodie...I have incorporated this little .HTA application into my daily routine to look up information on a system and some basic management tasks.

Check out: Computer Management Utility by Spiceworks user Stuart Barrett.

I know it's not a script you can run, but it does feature a "silent uninstall" button for items found in their add/remove programs list. I've successfully used it to silently remove software from user's PCs without interrupting them.

Hope this helps!

mister.i
mister.i This person is a Verified Professional
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Mar 1, 2019 at 15:58 UTC

jackofalltech wrote:

I'm reg edit browse to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall.

Find the key the contains the software you want to uninstall

There will be a value for the uninstall string that is what you run

THIS.  And look at https://community.spiceworks.com/topic/647939-show-all-programs-using-wmic-command.  That's the only places that groups all the installers, MSI and non-MSI, into one location.

This topic has been locked by an administrator and is no longer open for commenting.

To continue this discussion, please ask a new question.

How to Uninstall a Program Using Cmd in Windows 10

Source: https://community.spiceworks.com/topic/2195742-how-to-uninstall-a-program-using-cmd-or-power-shell