Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to lookup a username from dsquery using the office parameter as we store IDs inside of the office parameter.

Any ideas on how to get their username?

I tried

dsquery user -office "IDHERE"

but I got an unknown parameter error.

share|improve this question
up vote 0 down vote accepted

dsquery does not have an attribute office. dsget does.

Something like this (untested) should to the job:

dsquery user -limit 0 | dsget user -full -office
share|improve this answer
Good idea. Saved my day! – Jamie H Jan 28 '13 at 10:34
So in the end I did the following command PS C:\Windows\system32> dsquery user -name * -limit 0 | dsget user -upn -display -office >> E:\output\output.txt – Jamie H Jan 28 '13 at 12:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.