Solved

Dsquery User | Dsget User

Posted on 2009-05-11
6
4,564 Views
Last Modified: 2012-05-06
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
Comment
Question by:CMILLER
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:Miele102
ID: 24357831
Hi
Try the sort.
C:\> dsquery user -limit 0 "OU=XXX,DC=XX,DC=XXX" | sort | dsget user -ln -fn -mi -c
0
 

Author Comment

by:CMILLER
ID: 24357888
Nope, didnt work.
0
 
LVL 57

Accepted Solution

by:
Mike Kline earned 500 total points
ID: 24357901
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:CMILLER
ID: 24357969
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
 
LVL 57

Expert Comment

by:Mike Kline
ID: 24358110
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
 

Author Comment

by:CMILLER
ID: 24358254
All it did was create a %,% column.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question