[python-win32] Finding users home directories
Giampaolo Rodola'
billiejoex at gmail.com
Sat Jan 12 19:04:23 CET 2008
Hi,
I'm trying to use the pywin32 extension to find out the users home directories.
Currently I found a way for doing that but it requires to validate the
user by providing its username + password:
def get_homedir(username, password):
token = win32security.LogonUser(
username,
None,
password,
win32security.LOGON32_LOGON_NETWORK,
win32security.LOGON32_PROVIDER_DEFAULT
)
return win32profile.GetUserProfileDirectory(token)
What I'd like to do is avoiding the requirement of the password, in
the same way as if I would on UNIX where it would be enough just using
the pwd module and providing the username only:
>>> import pwd
>>> pwd.getpwnam('user').pw_dir
'/home/user'
Does someone know if it is possible to do that?
Thanks in advance
More information about the python-win32
mailing list