Powershell: Uninstall a software/program

Veröffentlicht in: Powershell, VMM

to uninstall a software, from for example a core server, using powershell you may use these script snipplets I found today having the need to uninstall a program rom a non GUI server.

At first you may want to list all installed programs:

Get-WmiObject -Class Win32_Product

Look for the software to uninstall in that list and copy a significant part of the “Name” to clipboard.

(i was looking to uninstall the “MS VMM DHCP Server (x64)” stuff, so I entered the following line to filter just for that:

Get-WmiObject -Class Win32_Product -Filter „Name like ‚%DHCP Server%'“

and then added the uninstall routine to the command to finallize the removal of the software:

Get-WmiObject -Class Win32_Product -Filter „Name like ‚%Microsoft System Center Virtual Machine Manager DHCP Server (x64)%'“ | ForEach-Object { $_.Uninstall()}

Finally you may want to check that the software is really not listed anymore using:

Get-WmiObject -Class Win32_Product