By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,425 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

MS Access Querying Avtive Directory

Denburt
Expert 100+
P: 1,356
All I am looking for is to run a query and see the users listed in AD. I have found all sorts of Dot net stuff but MS Access is limited it seems. I know I am overlooking something that is probably quite simple.

What I would like to do is run a query and step through each user verifying the users Location (city).

So far I have found the following helpful but I need to use this in a list of users i can extract from AD. or something to that effect. I know SYSINFO.UserName is me but how can I list all users?

Expand|Select|Wrap|Line Numbers
  1.    Set SYSINFO = CreateObject("ADSystemInfo")
  2.     Set ouser = GetObject("LDAP://" & SYSINFO.UserName & "")
  3.     ouser.OfficeLocations
  4.  

Thanks in Advance
Sep 5 '07 #1
Share this Question
Share on Google+
2 Replies


Jim Doherty
Expert 100+
P: 897
All I am looking for is to run a query and see the users listed in AD. I have found all sorts of Dot net stuff but MS Access is limited it seems. I know I am overlooking something that is probably quite simple.

What I would like to do is run a query and step through each user verifying the users Location (city).

So far I have found the following helpful but I need to use this in a list of users i can extract from AD. or something to that effect. I know SYSINFO.UserName is me but how can I list all users?

Expand|Select|Wrap|Line Numbers
  1.    Set SYSINFO = CreateObject("ADSystemInfo")
  2.     Set ouser = GetObject("LDAP://" & SYSINFO.UserName & "")
  3.     ouser.OfficeLocations
  4.  

Thanks in Advance
Try

Expand|Select|Wrap|Line Numbers
  1. http://www.microsoft.com/technet/scriptcenter/guide/sas_srv_lxfr.mspx?mfr=true
Sep 5 '07 #2

Denburt
Expert 100+
P: 1,356
WOW thanks almost what I need now with a little tweaking I might be able to get this to work, if I don't get fired first. For anyone interested. First I had to reduce the page size and increased the timeout. I am still playing with those numbers but they were my first hurdle.

I took the following:

Expand|Select|Wrap|Line Numbers
  1. objCommand.CommandText = _
  2.  "SELECT Name, Location FROM 'LDAP://DC=someCO,DC=com' " _
  3.  & "WHERE objectClass='Computer'"
  4.  
And tried several substitutes... The following gave me some very interesting computer names No user names yet though... Man a guy could really get into trouble if not careful.

Expand|Select|Wrap|Line Numbers
  1. objCommand.CommandText = _
  2.  "SELECT Name, Location FROM 'LDAP://DC=someCO,DC=com' " _
  3.  & "WHERE objectClass='User'"
  4.  
BINGO thanks for pointing me in the right direction I did a little digging there and found exactly what I needed, now I need to decide how I am going to implement this in my DB. Oh yeah the link for viewing users is here:

http://www.microsoft.com/technet/scr....mspx?mfr=true


Many thanks Jim!
Sep 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.