PowerShell help to create CSV with specific user data

I am trying to create a .csv file with user data from a specific OU in Active directory.  

First Name
Last Name
Full Name
Email Address

Can someone please provide me with a powershell statement that will get this information into a CSV file?  This is what I have so far:

1. Open PowerShell, as an administrator, on a Domain Controller computer

2. Type in:

Get-ADUser -SearchBase "OU=Atlanta,OU=Georgia,DC=Company,DC=ORG" -prop * -Filter * | select SamAccounName,FirstName,LastName,FullName,Description,EmailAddress | export-csv c:\users\me\desktop\user-info-atlanta.csv

I am obviously new to PowerShell, so I want to be sure no data will be edited, only read =)
Who is Participating?
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.

Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
The optimized solution will be this:

Get-ADUser -SearchBase "OU=Atlanta,OU=Georgia,DC=Company,DC=ORG" -Filter * -Properties EmailAddress,Description  | Select SamAccounName,GivenName,SN,Name,Description,EmailAddress | Export-Csv -NoTypeInformation  c:\users\me\desktop\user-info-atlanta.csv

Open in new window

By using -Prop * you are bringing 114 properties (for exch 2013) from those you are using just 2, so no need to ask for the 114 if you're using just 2, that's why the solution,

Givenname => firstname
Lastname => sn
Full Name => name

And at the end I added the -notypeinformation, here's the documentation: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-6

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
npinfotechAuthor Commented:
Thank you, and thank you for making it more efficient.

You mention Microsoft Exchange above; will the statement work if I do not have Microsoft Exchange?  

Also, is there anything that needs to be typed in first (something like import-module), or can I start with the "Get-ADUser" command right away?
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Get-ADUser does not require Exchange. However, Exchange stores info in AD, and so you can get added info if installed.
PowerShell 3 and above do not require to implicitly import modules anymore, as long as the modules are in the paths set up for modules. The ActiveDirectory module is imported automatically with the first AD cmdlet you run in a session.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

npinfotechAuthor Commented:
Thank you for the clarification, i really appreciate it.  The statement worked well.

The SN portion of the statement does not return the last name in the CSV file (last name for each user appears as a blank).  I right clicked on some of the users in "Active Directory users and computers", looked at the properties of some of the users and it did have the last name under SN.  Is there another way I can pull the last name?
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Try with SurName.
npinfotechAuthor Commented:
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

From novice to tech pro — start learning today.