Phoe6 wrote:
> 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:

[... snip ...]

> did not work

> There is script example given the M$ site:
> <example_snippet>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:" _
>     & "{impersonationLevel=impersonate}!\\" _
>     & strComputer & "\root\cimv2")

That's exactly equivalent to:

c = wmi.WMI ()

> Set colSoftware = objWMIService.ExecQuery _
>     ("Select * from Win32_Product " _
>         & "Where Name = 'Personnel database'")
> For Each objSoftware in colSoftware
>     objSoftware.Uninstall()
> Next

That's the same as:

for product in c.Win32_Product (Name="Personnel database"):
  product.Uninstall ()

(all the module is doing is wrapping the MS code a bit
more pythonically).

TJG

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to