[python-win32] accessing Win32_Tpm()

prashant padaganur prashantpadaganur at gmail.com
Wed Jun 20 14:01:12 CEST 2012


>> Hi,
>>
>> I am new to WMI.
>>
>> I have installed WMI for python and pywin32 extensions to be able to use
>> win32 apis from my python scripts. While I can get all the info from
>> other clasees like Win32_Battery, Win32_Processor I am having tough time
>> with Win32_Tpm class.
>>
>> I want to use Win32_Tpm module in python to play around with various tpm
>> features, but all my references to win32_tpm are returning null.

>What do you get if you do?
>
><code>
>import wmi
>print wmi.WMI ().Win32_Tpm
>
></code>
>
>On my Win7 machine, it's not even present. I know nothing about the
>technology it's proxying so it may well be that the underlying
>stuff isn't there to be represented.
>
>TJG

Thanks to your tutorial on WMI I had tried this yesterday. I get the
following error when I try printing wmi.WMI ().Win32_Tpm.
---------
Traceback (most recent call last):
  File "C:/Users/ppadagax/Documents/Scripts/freshTpm.py", line 14, in
<module>
    print wmi.WMI ().Win32_Tpm
  File "C:\Python27\lib\site-packages\wmi.py", line 1147, in __getattr__
    return getattr (self._namespace, attribute)
  File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line
516, in __getattr__
    raise AttributeError("%s.%s" % (self._username_, attr))
AttributeError: winmgmts:.Win32_Tpm
----------

More info about Win32_Tpm class here:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa376484(v=vs.85).aspx

I have this Tpm chip in my machine which runs on Windows 7 and when I run
tpm.msc from the windows run tab, I get all the info from GUI. I need to
access the same information programatically through python. I saw few code
samples on the internet which implement the same using VB or C#. What I
essentially need is the python version of this link which shows how to
access Win32_Tpm info using .Net.

http://blogs.msdn.com/b/securitytools/archive/2009/07/29/wmi-programming-using-c-net.aspx


Br
Prashant Padaganur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120620/695fd79c/attachment.html>


More information about the python-win32 mailing list