Tech Support > Operating Systems > Windows 2003 > dsquery and dsget
dsquery and dsget
Posted by DMC on December 16th, 2003


I am trying to query AD for billing purposes. Basically, we bill remote locations based on the number of users.

I was trying to find an easy way to query AD to do this.

I want a list that displays a list of users in one column and the respective office location in a column right next to it.

I am able to run: dsquery user "ou=Users,dc=abc,dc=com" -limit 300 -o rdn > users.txt ...this creates a file with the list of users.

I am able to run: dsquery user -name * | dsget user -office ....this creates a listing of the office locations for all users (but doesnt list the usernames beside the office locations).

If you put both of these files together, the list of users will correctly match up with appropriate office locations.

I need to write a query statement to query for both and list both side by side in 2 columns. Is this possible? How?

Posted by Dean Wells [MVP] on December 17th, 2003


DMC wrote:
Maybe ...

dsquery user -name * | dsget user -dn -office

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l



Posted by DMC on December 17th, 2003


This gets me the data that I am looking for...thank you very much for that.

There is one problem with the formatting... I am trying to use the " -o rdn" switch so I do not get the fully qualified name of the user objects. I want to just display the simple (common) name.

Thank you once again.

Posted by DMC on December 17th, 2003


And one more question...any idea on how to point this to a specific OU instead of all of them?

Posted by Dean Wells [MVP] on December 18th, 2003


DMC wrote:
dsquery user ou=MSEtechnology,dc=mset,dc=local -name * | dsget
user -samid -office

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l