Accessing Add/Remove Programs Details

Phoe6 orsenthil at gmail.com
Fri Sep 8 12:52:11 EDT 2006


Tim Golden wrote:
> [Phoe6]
> and perhaps you need something like
> this (altho' obviously more sophisticated):
> <code>
> import wmi
>
> appname = "Python 2.4.3"
> c = wmi.WMI ()
> for product in c.Win32_Product (Caption=appname):
>   print product.Caption
>   # product.Uninstall ()
>
> </code>

Thanks Tim for the reply. I started looking along the same lines.
It looks like, I need to give the Product details exactly as it is
registered(?).
Trying out stuff like:
>>> import wmi
>>> appname = "IsoBuster 1.9.1"
>>> c = wmi.WMI()
>>> for product in c.Win32_Product(Caption=appname):
	print product.Caption
	ret_val = product.Uninstall()
	print ret_val


>>>
Did not work.

There is script example given the M$ site:
<example_snippet>
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
    ("Select * from Win32_Product " _
        & "Where Name = 'Personnel database'")
For Each objSoftware in colSoftware
    objSoftware.Uninstall()
Next

</example_snippet>

I guess to convert the same to python.  I shall try more and keep
posted.

Thanks,
Senthil




More information about the Python-list mailing list