On 20/06/2012 13:01, prashant padaganur wrote: > 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
According to: http://msdn.microsoft.com/en-us/library/windows/desktop/aa376484%28v=vs.85%29.aspx the Win32_Tpm class is in its own namespace. So try this: <code> import wmi c = wmi.WMI(namespace="root/cimv2/security/microsofttpm") for whatever in c.Win32_Tpm(): # do whatever </code> TJG _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32