I am trying to uninstall a product I have recently added to my Windows and i tried to access the normal way of uninstallation

which you can go Control PanelProgramsPrograms and Features


The problem is that the product I am trying to uninstall is not displayed there, although the product is available in the start menu


So I will use Powershell and WMI to uninstall it

gwmi win32_product


gwmi win32_product -filter "name=’HP ProtectTools Security Manager’"


now I will try to find what is the available methods that we can use with this class

I can write gwmi win32_product -filter "name=’HP ProtectTools Security Manager’" |gm or gwmi win32_product |gm


to call a method you have attach your command to a variable then call the varable.method()

to attach it to variable type $varname=the command

$product=gwmi win32_product -filter "name=’HP ProtectTools Security Manager’"

Now we can attach Uninstall method to the variable


this should work fine but as I am tring this example on Windows 7 it gave me return value of 1603 it means some thing that is not 0 (normal exit)


I investigated the problem and I found as usual the application is running under non elevated privilege I should select Run as Administrator.


I did so and I tried the command again and it gave me return value of Zero.


Article Code

1 $product=get-wmiobject win32_product -filter "Vendor=’Hewlett-Packard’"
2 $product.uninstall()

Mahmoud Ibrahim (admin)

About the Author

Mahmoud Ibrahim has technology experience with over 18 years of IT industry. He'd worked in many organizations in many roles and expanded his knowledge across technology stacks, and he is enjoying sharing his expertise whenever possible :).
He is working as a presales expert in Micro Focus serving the international community.

View all posts by Mahmoud Ibrahim (admin)
Previous Article
Next Article