[python-win32] Re: Creating users

Roger Upole rwupole at msn.com
Thu Mar 9 03:01:18 CET 2006


James Carroll wrote:
> I've got one more question for you if I haven't bugged you too much
> today.  I'm getting the list of usernames of active users, but the
> next thing I need is that user's APPDATA directory.
> 
> APPDATA=C:\Documents and Settings\username\Application Data
> 
> I'm tempted to get the APPDATA directory for the current user, and the
> username, and do a replace on the username directory, but If there's a
> more foolproof way of knowing what the APPDATA directory will be for
> that user, I'd sleep better.
> 
> Do you know of a better way?
> 
> Thanks again,
> -Jim

That's not going to be 100% reliable.  You can have a profile for a local
user and a domain user with the same name.  One of them ends up as
username.machinename or username.domain, depending on which profile
was created first.  Plus you might have to deal with roaming profiles.

You could probably create a logon script.  That way you'll have the
exact directory available. And it will ensure that any new users created in the
future will obtain whatever files are needed when they log in.

        Roger



More information about the Python-win32 mailing list