Finding User Profile path

kyosohma at gmail.com kyosohma at gmail.com
Thu Mar 29 08:59:01 EDT 2007


On Mar 29, 2:50 am, Tim Golden <m... at timgolden.me.uk> wrote:
> kyoso... at gmail.com wrote:
> > Hi,
>
> > I am trying to query our domain to get a list of our users profile
> > locations. I thought I might be able to use WMI, but I can't get it to
> > work.
>
> Can you be a bit more specific: did WMI itself not work? Or the
> Python WMI module? What were the problems? (All this, obviously,
> if you're interested in pursuing that path).
>
> I am using a Windows XP Pro workstation and Python 2.4 on a
>
> > mixed environment of Debian Linux (with Samba) and Windows servers. We
> > are in the process of moving the user profiles from an NT box to a
> > Debian box, but due to the many different servers in the organization,
> > it is a pain to keep track of which have been moved and which haven't.
>
> Have a look at the win32net module from the pywin32
> extensions, specifically functions like NetUserGetInfo
> and NetUserSetInfo. You have to pick your USER_INFO a
> bit (look around the MSDN pages) but I think you can do
> what you're after.
>
> TJG

Thanks for the reply. One of my co-workers thought I could do
something like this:

c = wmi.WMI()
for i in c.Win32_UserAccount(Name=user):
    # Get user paths somehow.

I messed around with that, but I think he was mistaken. It has lots of
good info, but not what I need.

I apologize for not being specific. I will look at those win32net
functions.

Mike




More information about the Python-list mailing list