[python-win32] Problem with OLE error 0x80041002

Tim Golden mail at timgolden.me.uk
Fri Dec 11 15:16:12 CET 2009


Gowtham wrote:
> I have a python script that retrieves the user profile path from the
> registry using wmi. I am doing this way as win32net.NetUserGetInfo could not
> somehow find the domain user.  Here the code snippet-

{... snipped snippet ...]

Does this reveal anything?

<code>
import _winreg
import wmi

reg = wmi.WMI (namespace="default").StdRegProv
print reg.CheckAccess (
  _winreg.HKEY_LOCAL_MACHINE,
  r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList",
  _winreg.KEY_QUERY_VALUE | _winreg.KEY_ENUMERATE_SUB_KEYS
)
result, sids = reg.EnumKey (
  _winreg.HKEY_LOCAL_MACHINE,
  r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
)
for sid in sids:
  print sid

</code>

On the other hand, WMI doesn't offer you much here: if you
have a working solution via the Win32 API, then unless you
need to do this on remote machines with specific credentials
(which you can't do with the standard API) then perhaps you
needn't try too hard...

TJG


More information about the python-win32 mailing list