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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun VermaakTechnical Specialist/DeveloperCommented:
Using Powershell
Import-Module ActiveDirectory
Get-ADUser -Filter * -SearchBase "OU=SomeOU,DC=Domain,DC=com -Properties sAMAccountName

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michael PfisterCommented:
0
Tom CieslikIT 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
Problems using Powershell and Active Directory?

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

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 CrawfordTransport 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.