[Tutor] WMI

Tim Golden mail at timgolden.me.uk
Tue Sep 16 21:01:48 CEST 2008

Spencer Parker wrote:
> Has anyone here had any experience with WMI extensions in Python?
> I am trying to remotely change the IP, Subnet, and gateway of a windows 
> machine, but I cannot figure out what it needs to change this. 

You'll need the Win32_NetworkAdapterConfiguration class and,
for ease, the wmi module from here:


import wmi

c = wmi.WMI ()

for i in c.Win32_NetworkAdapterConfiguration (IPEnabled=True):
   print i

You'll need things like the .SetGateways method. You can see
all the methods thus:

print "\n".join (i.methods)

and if you print any of them, it will show its signature:

print i.SetGateways



More information about the Tutor mailing list