1

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.

Aliaksandr Belik
  • 259
  • 6
  • 17
Jamie
  • 214
  • 1
  • 2
  • 12

1 Answers1

0

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
Bart De Vos
  • 17,911
  • 6
  • 63
  • 82
  • 1
    Good idea. Saved my day! – Jamie 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 Jan 28 '13 at 12:38