Retrieve user OU info from WMI?

G

Guest

Using a vbscript, I can interate through the RSOP_GPO class in
root\rsop\computer and get the fully qualified OU for the machine.

Is there a way to do the same for a user? The only way I know how to do
this is to first get the SID for the user then iterate through the RSOP_GPO
class in root\rsop\user\<SID>. Getting the SID isn't easy either....

Thanks in advance.
 
J

James Crosswell

Matt said:
Using a vbscript, I can interate through the RSOP_GPO class in
root\rsop\computer and get the fully qualified OU for the machine.

Is there a way to do the same for a user? The only way I know how to do
this is to first get the SID for the user then iterate through the RSOP_GPO
class in root\rsop\user\<SID>. Getting the SID isn't easy either....

Thanks in advance.

Can't you get this info from ADSI? It's probably more appropriate to get
directory information (and OUs are certainly that) via ADSI than WMI.
WMI is good at handling individual machines - but ADSI is much better at
handling the directory stuff.

--

Best Regards,

James Crosswell
Software Engineer
Microforge.net Limited
http://www.microforge.net
 
G

Guest

thanks for the reply.

I could, but I am trying to get the information locally in the event that
the machine is not connected to the network.

I previously used code (LDAP queries) to retrieve the information from AD.
 
J

James Crosswell

Matt said:
thanks for the reply.

I could, but I am trying to get the information locally in the event that
the machine is not connected to the network.

I previously used code (LDAP queries) to retrieve the information from AD.

But... if the machine wasn't connected to the network then it wouldn't
be part of any OU would it? OUs are directory objects... which implies
the requirement for a directory (i.e. network connectivity).

Am I way off base here?

--

Best Regards,

James Crosswell
Software Engineer
Microforge.net Limited
http://www.microforge.net
 
G

Guest

The OU information is stored for the computer in WMI, and is available when
the machine is disconnected from the network. I am hoping the user
information can be accessed the same way.
 
J

James Crosswell

Matt said:
The OU information is stored for the computer in WMI, and is available when
the machine is disconnected from the network. I am hoping the user
information can be accessed the same way.

Interesting - where is the OU information store for the computer when
it's not connected to any network (and thus not currently part of any
OUs)? Is this in the registry along with cached credentials etc for the
SID? If so, that would seem the logical place to keep looking for
similar cached information about a particular user's connection to a
particular network.

The catch 22, as I see it, is that if you already know the user/network
information then there's no point in searching for it. If you don't know
this information then you don't know where to look, since multiple users
could have used the machine to connect to multiple networks (and thus
there may be multiple sets of cached credentials - one for each
user/network pair). If you knew JUST the network that they were
connecting to then that might help narrow the search - but you still
might end up with a list of users - not just one user...

--

Best Regards,

James Crosswell
Software Engineer
Microforge.net Limited
http://www.microforge.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top