On 19/12/2011 14:20, cd wrote:
import wmi
c = wmi.WMI().Win32_ComputerSystem
computer = c()[0]
for propertyName in sorted( list( c.properties ) ):
if propertyName == 'Name':
print setattr( computer, propertyName, 'newname' )

Ah.

I'm afraid, good as WMI is, it's not that good. You need to
invoke the right method on the Win32_ComputerSystem instance.

The appropriate method is referenced here:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa393056%28v=vs.85%29.aspx


There are some examples here:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa394586%28v=vs.85%29.aspx


and the (definitely untested) Python equivalent is something
like this:

<code>
import wmi

c = wmi.WMI ()
for system in c.Win32_ComputerSystem ():
  system.Rename ("NEW-NAME", "TIM", "PASSWORD")

</code>

TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to