[python-win32] WMI and Terminal Services

Tim Golden mail at timgolden.me.uk
Mon Mar 28 16:19:16 CEST 2011


On 28/03/2011 15:16, Mike Driscoll wrote:
> On 1:59 PM, Tim Golden wrote:
>> On 25/03/2011 6:19 PM, Mike Driscoll wrote:
>>> Hi,
>>>
>>> I am looking for a way to query the client name parameter from Terminal
>>> Services. I have been testing several scripts I've found that use either
>>> win32com.client or win32ts, but they are giving me weird errors on
>>> Windows 7 64-bit.
>>>
>>> I get this traceback:
>>>
>>> <traceback>
>>>
>>> Traceback (most recent call last):
>>> File "\\server\loginscript$\getTSInfo.py", line 10, in ?
>>> for objItem in colItems:
>>> File
>>> "\\server\loginscript$\Python24\lib\site-packages\win32com\client\util.
>>> py", line 84, in next
>>> return _get_good_object_(self._iter_.next(), resultCLSID =
>>> self.resultCLSID)
>>>
>>> pywintypes.com_error: (-2147217392, 'OLE error 0x80041010', None, None)
>>> </traceback>
>>
>> Try this instead (using my wmi module 'cos I'm lazy):
>>
>> <code>
>> import wmi
>>
>> #
>> # Note the namespace
>> #
>> c = wmi.wmi (namespace="cimv2/TerminalServices")
>> for i in c.Win32_TSClientSetting ():
>> print i
>>
>> </code>
>>
>> TJG
>>
>
> That codes run just fine. I don't know if that's the info my colleague
> needs or not, but thanks a lot!

Well there, I'm afraid, I'm unable to help :)

TJG


More information about the python-win32 mailing list