On 07/04/2010 14:57, Kevin Holleran wrote:
Thanks, I was able to connect to the remote machine. However, how do I query for a very specific key value? I have to scan hundreds of machines and need want to reduce what I am querying. I would like to be able to scan a very specific key and report on its value.
The docs for the WMI Registry provider are here: http://msdn.microsoft.com/en-us/library/aa393664%28VS.85%29.aspx and you probably want this: http://msdn.microsoft.com/en-us/library/aa390788%28v=VS.85%29.aspx
With _winreg I could just do: keyPath = _winreg.ConnectRegistry(r"\\" + ip_a,_winreg.HKEY_LOCAL_MACHINE) try: hKey = _winreg.OpenKey (keyPath, r"SYSTEM\CurrentControlSet\services\Tcpip\Parameters", 0, _winreg.KEY_READ) value,type = _winreg.QueryValueEx(hKey,"Domain") Also, is there a performance hit with WMI where perhaps I want to try to connect with the inherited credentials using _winreg first and then use the MWI if that fails?
Certainly a consideration. Generally WMI isn't the fastest thing in the world either to connect nor to query. I suspect a try/except with _winreg is worth a go, falling through to WMI. TJG -- http://mail.python.org/mailman/listinfo/python-list