Finding User Profile path
Tim Golden
mail at timgolden.me.uk
Thu Mar 29 11:30:53 EDT 2007
[resending as the original seems to have got lost;
apologies if it appears as a duplicate]
At the risk of insulting your intelligence, here's a
rough-and-ready non-AD solution (culled from some code I
had somewhere):
<code>
import win32net
import win32netcon
dc = win32net.NetGetAnyDCName (None, None)
#
# Or your specific server name, if you want
#
resume = 0
while 1:
(_users, total, resume) = \
win32net.NetUserEnum (
dc,
3,
win32netcon.FILTER_NORMAL_ACCOUNT,
resume,
win32netcon.MAX_PREFERRED_LENGTH
)
for _user in _users:
print _user['name'], _user['home_dir'], _user['profile']
if not resume:
break
</code>
TJG
More information about the Python-list
mailing list