Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Dsquery User | Dsget User

Posted on 2009-05-11
6
4,578 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Resolve DNS query failed errors for Exchange
In-place Upgrading Dirsync to Azure AD Connect
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

856 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