Link to home
Start Free TrialLog in
Avatar of Chris Miller
Chris MillerFlag for United States of America

asked on

Dsquery User | Dsget User

I need a script that will output in a xls file the -LN, -FN -MI

I am using this but it will not output -LN, -FN -MI

C:\> dsquery user -limit 0 "OU=XXX,DC=XX,DC=XXX" | dsget user -ln -fn -mi -c

It outputs -FN -MI -LN, How do I get it in the order that I need it in?
Avatar of Miele102
Miele102
Flag of Netherlands image

Hi
Try the sort.
C:\> dsquery user -limit 0 "OU=XXX,DC=XX,DC=XXX" | sort | dsget user -ln -fn -mi -c
Avatar of Chris Miller

ASKER

Nope, didnt work.
ASKER CERTIFIED SOLUTION
Avatar of Mike Kline
Mike Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That worked, Thanks.

Do you know if it would also output this way.

LASTNAME, FIRSTNAME MI

All in one cell with the comma after the lastname.
interesting followup  not sure, you can add an extra comma

adfind -b "OU=xxx,dc=xxx,dc=xxx" -f  "&(objectcategory=person)(objectclass=user)"  sn %,% givenname initials -csv -nodn > c:\users.csv
 ...but I'm not sure about all in one cell
All it did was create a %,% column.