[python-win32] WMI and Terminal Services

Tim Golden mail at timgolden.me.uk
Fri Mar 25 22:46:07 CET 2011


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


More information about the python-win32 mailing list