HI all,
i have some problem with the code belove, i have a list of servers in
a textfile (elencopc.txt). ... i would to retrieve informations via WMI
( cicle for ), but i don't understand if the code is correct:
import win32com.client
import string
import sys
listserver = open('c:\\elenc opc.txt','r')
objWMIService = win32com.client .Dispatch("Wbem Scripting.SWbem Locator")
objSWbemService s = objWMIService.C onnectServer(li stserver,"root
\cimv2")
colItems = objSWbemService s.ExecQuery("Se lect * from
Win32_QuickFixE ngineering")
for objItem in colItems:
print "Caption: ", objItem.Caption
print "Descriptio n: ", objItem.Descrip tion
print "Fix Comments: ", objItem.FixComm ents
print "HotFix ID: ", objItem.HotFixI D
print "Install Date: ", objItem.Install Date
print "Installed By: ", objItem.Install edBy
print "Installed On: ", objItem.Install edOn
print "Name: ", objItem.Name
print "Service Pack In Effect: ", objItem.Service PackInEffect
print "Status: ", objItem.Status
I receive the error :
ile "C:\Python25\Li b\site-packages\win32c om\client\dynam ic.py", line
258, in _ApplyTypes_
result = self._oleobj_.I nvokeTypes(*(di spid, LCID, wFlags,
retType, argTypes) + args)
com_error: (-2147352567, 'Exception occurred.', (0, 'SWbemLocator',
'The RPC server is unavailable. ', None, 0, -2147023174), None)
MY big dubt is if the code is correct... because if i use vbscript all
works fine..
thanks a lot in advance
i have some problem with the code belove, i have a list of servers in
a textfile (elencopc.txt). ... i would to retrieve informations via WMI
( cicle for ), but i don't understand if the code is correct:
import win32com.client
import string
import sys
listserver = open('c:\\elenc opc.txt','r')
objWMIService = win32com.client .Dispatch("Wbem Scripting.SWbem Locator")
objSWbemService s = objWMIService.C onnectServer(li stserver,"root
\cimv2")
colItems = objSWbemService s.ExecQuery("Se lect * from
Win32_QuickFixE ngineering")
for objItem in colItems:
print "Caption: ", objItem.Caption
print "Descriptio n: ", objItem.Descrip tion
print "Fix Comments: ", objItem.FixComm ents
print "HotFix ID: ", objItem.HotFixI D
print "Install Date: ", objItem.Install Date
print "Installed By: ", objItem.Install edBy
print "Installed On: ", objItem.Install edOn
print "Name: ", objItem.Name
print "Service Pack In Effect: ", objItem.Service PackInEffect
print "Status: ", objItem.Status
I receive the error :
ile "C:\Python25\Li b\site-packages\win32c om\client\dynam ic.py", line
258, in _ApplyTypes_
result = self._oleobj_.I nvokeTypes(*(di spid, LCID, wFlags,
retType, argTypes) + args)
com_error: (-2147352567, 'Exception occurred.', (0, 'SWbemLocator',
'The RPC server is unavailable. ', None, 0, -2147023174), None)
MY big dubt is if the code is correct... because if i use vbscript all
works fine..
thanks a lot in advance
Comment