473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Finding User Profile path

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. 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.

Thank you for any help.

Mike

Mar 28 '07 #1
8 2622
ky******@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
Mar 29 '07 #2
On Mar 29, 2:50 am, Tim Golden <m...@timgolden.me.ukwrote:
kyoso...@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

Mar 29 '07 #3
ky******@gmail.com wrote:
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
Might depend on what you mean by "profile" but would the
users' homeDirectory/homeDrive active directory attributes
or the profilePath be of use here? If so, they're fairly
easy to get hold of.

TJG
Mar 29 '07 #4
On Mar 29, 8:23 am, Tim Golden <m...@timgolden.me.ukwrote:
kyoso...@gmail.com wrote:
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

Might depend on what you mean by "profile" but would the
users' homeDirectory/homeDrive active directory attributes
or the profilePath be of use here? If so, they're fairly
easy to get hold of.

TJG
Yes. It's the homeDirectory as you say. Once again the IT community's
use of multiple terms for the same thing has bitten me.

Mike

Mar 29 '07 #5
ky******@gmail.com wrote:
On Mar 29, 8:23 am, Tim Golden <m...@timgolden.me.ukwrote:
>kyoso...@gmail.com wrote:
>>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
Might depend on what you mean by "profile" but would the
users' homeDirectory/homeDrive active directory attributes
or the profilePath be of use here? If so, they're fairly
easy to get hold of.

TJG

Yes. It's the homeDirectory as you say. Once again the IT community's
use of multiple terms for the same thing has bitten me.
I take it you're OK for getting things out of AD?

TJG
Mar 29 '07 #6
On Mar 29, 9:05 am, Tim Golden <m...@timgolden.me.ukwrote:
kyoso...@gmail.com wrote:
On Mar 29, 8:23 am, Tim Golden <m...@timgolden.me.ukwrote:
kyoso...@gmail.com wrote:
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
Might depend on what you mean by "profile" but would the
users' homeDirectory/homeDrive active directory attributes
or the profilePath be of use here? If so, they're fairly
easy to get hold of.
TJG
Yes. It's the homeDirectory as you say. Once again the IT community's
use of multiple terms for the same thing has bitten me.

I take it you're OK for getting things out of AD?

TJG
Actually no. Our organization does not use Active Directory. In fact,
the server I need to query happens to be an NT 4.0 box. We do have a
Win2k Server, but it is for specialized services.

Mike

Mar 29 '07 #7
[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
Mar 29 '07 #8
On Mar 29, 10:30 am, Tim Golden <m...@timgolden.me.ukwrote:
[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
Thanks a lot. That seems to work the way we need. And don't worry too
much about my intelligence...I've only been programming in Python
since last May.

Mike

Mar 29 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Wayne Gibson | last post by:
Hi all, Please ignore the other post.. The cat jumped on the machine and sent it before I could stop it!! Was wondering if anybody has expericence this problem.. I am writting an application...
0
by: Grant_S | last post by:
I need to identify the path to a users "My Document" folder where the user has a roaming profile and their "My Documents" folder is mapped to a network share as the H drive (specifically H:\\ -...
1
by: pei_world | last post by:
hi I am new to C# programming. can anyone tell me what is the standard way to store high sensitive user data for application, so that application next run can get back those data.
2
by: | last post by:
Hi all, How can I get a reference to my custom profile provider in my .aspx page? I have looked at httpcontext.current.profile. But from there where do I go? Ideally I would like to be able to...
2
by: Iceken | last post by:
Hi, In my app I need to delete several user profiles inside the Documents and Settings folder. But everytime i try Directory.Delete(path) I get a IOException with "Access denied to path ..",...
12
by: wheels619 | last post by:
How can I get access for another user's special folder locations? A configuration file is stored in the users' appData folder and the program altering it will be ran under the admin.
9
by: =?Utf-8?B?Sm9obiBBdXN0aW4=?= | last post by:
I have an app that prints entry tickets. If the printer driver is not set up exactly to detect the black mark on the back of the ticket, the tickets do not print correctly. Because of this, all...
4
by: Scott M. | last post by:
When profile data is stored in ASP .NET, where is the user data persisted? For how long is it persisted: is it session persisted or permanent (like a cookie)?
2
by: Henry Hollenberg | last post by:
Hello, I have written a script that uses environment variables set during a particular users login in ".bash_profile" and ".profile". I have changed to that users uid and gid in my python...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.