I need to determine the number of open files under Win32. I'm porting some VBScript code and need to access "WinNT://./LanmanServer". I think I can do that with win32.com.client.Dispatch, but am not sure of the syntax.
Here's the VBScript code:
Set Resources = GetObject("WinNT://./LanmanServer").Resources
For Each Resource in Resources
OpenFiles = OpenFiles + 1
Next
Here is WMI access in Python, which I think is similar:
wmi_service = win32com.client.Dispatch("WbemScripting.SWbemLocator")
for item in wmi_service.ConnectServer(".", "root\cimv2").ExecQuery(query):
value = getattr(item, name)
How would I count the Resources in LanmanServer with Python (or count open files through WMI)? Thanks