[python-win32] rename computer

cd christophedeze at wanadoo.fr
Mon Dec 19 15:20:38 CET 2011


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' )
...
Traceback (most recent call last):
File "", line 3, in 
File "C:\Python27\lib\site-packages\wmi.py", line 571, in __setattr__
handle_com_error ()
File "C:\Python27\lib\site-packages\wmi.py", line 241, in handle_com_error
raise klass (com_error=err)
wmi.x_wmi: 












> Message du 19/12/11 14:48
> De : "Tim Golden" 
> A : python-win32 at python.org
> Copie à : 
> Objet : Re: [python-win32] rename computer
> 
> On 19/12/2011 11:57, cd wrote:
> > hello
> > I didn't find any example of howto rename a windows computer with python ?
> >
> > i've tried with wmi unsuccessfully ....
> 
> What did you try with WMI, and what happened?
> 
> TJG
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
> 


More information about the python-win32 mailing list