Export user logon names from OU with in AD.

How do I export user logon name's from OU with in  AD

thanks
sanjay macwanAsked:
Who is Participating?
 
Shaun VermaakConnect With a Mentor Technical Specialist/DeveloperCommented:
Using Powershell
Import-Module ActiveDirectory
Get-ADUser -Filter * -SearchBase "OU=SomeOU,DC=Domain,DC=com -Properties sAMAccountName

Open in new window

1
 
Michael PfisterCommented:
0
 
Tom CieslikConnect With a Mentor IT EngineerCommented:
If you want to have a list in excel format then use this:

Get-ADUser -Filter 'Name -like "*"' | Select-Object Name,SamAccountName | Export-Csv c:\Usernames.csv

Open in new window


You can add OU to export if you have more than one
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
Kevin StanushApplication DeveloperCommented:
Not sure what you mean by 'logon name', but there is built-in exporting in ADUC, where you can copy anything displayed to text/clipboard.

Or, get a copy of Hyena and export anything you want by OU, domain, etc.
0
 
Jason CrawfordConnect With a Mentor Transport NinjaCommented:
Adding on to Shaun's comment, it looks like his one-liner just needs a closing parenthesis on the OU DN.  Adding option of .csv file saved to the desktop:

Import-Module ActiveDirectory
Get-ADUser -Filter * -SearchBase "OU=SomeOU,DC=Domain,DC=com" -Properties sAMAccountName | Select-Object sAMAccountName | Export-Csv "$env:USERPROFILE\Desktop\samaccountname.csv" -NoTypeInformation

Open in new window

1
 
Jason CrawfordTransport NinjaCommented:
Thanks Ajit that's exactly what Shaun said.
0
 
sanjay macwanAuthor Commented:
Thank you all for helping me out with this request.

Excellent services.

Sanjay
0
 
Jason CrawfordTransport NinjaCommented:
Sanjay, if you found one or more of these comments helpful please mark them as the answer so we can close this question out.  Thanks.
0
 
Tom CieslikIT EngineerCommented:
Best solution and assisted solutions provided, no more other questions from author
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.

All Courses

From novice to tech pro — start learning today.