• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4893
  • Last Modified:

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?
0
CMILLER
Asked:
CMILLER
  • 3
  • 2
1 Solution
 
Miele102Commented:
Hi
Try the sort.
C:\> dsquery user -limit 0 "OU=XXX,DC=XX,DC=XXX" | sort | dsget user -ln -fn -mi -c
0
 
CMILLERAuthor Commented:
Nope, didnt work.
0
 
Mike KlineCommented:
another good tool for this is adfind by Joe Richards
http://www.joeware.net/freetools/tools/adfind/index.htm
adfind -b "OU=xxx,dc=xxx,dc=xxx" -f  "&(objectcategory=person)(objectclass=user)"  sn givenname initials -csv -nodn > c:\users.csv
That will create a csv file on your c drive
Thanks
Mike
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
CMILLERAuthor Commented:
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.
0
 
Mike KlineCommented:
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
0
 
CMILLERAuthor Commented:
All it did was create a %,% column.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now