Need an export of Active Directory users created before a certain date

I need a script/command to export a list of currently enabled AD users that were created before June 2015 on our network. This info can be seen from the AD User Object tab in the category - Created:

I'm not sure if this is possible. Please assist if you can. Thanks.
Jody DavisSystems EngineerAsked:
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.

FOXActive Directory/Exchange EngineerCommented:
1. create a folder named Temp on your c:drive

command to run

Get-ADUser -filter * -properties DisplayName,SamAccountname,WhenCreated |  ?{$_.whenCreated -le (get-date "June 1, 2015")} | Select DisplayName,SamAccountname,WhenCreated,Enabled | sort Enabled | sort DisplayName | Export-Csv c:\temp\results.csv' -notypeinformation
0

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
footechCommented:
$date = Get-Date "6/1/2015"
Get-ADUser -Filter {whenCreated -lt $date -and Enabled -eq $true} -Properties whenCreated | Select samaccountName,whenCreated | sort whencreated | Export-CSV report.csv -notype

Open in new window

0
Steven CarnahanNetwork ManagerCommented:
@Fox:  Very nice code.  I was just about to add my code when I refreshed and saw yours.  I didn't include the Display Name or the Enabled but did include the Office.

Get-ADUser -Filter * -properties SamAccountname,office,whencreated | ? { $_.whenCreated -le (get-date "June 1, 2015")}|Select Samaccountname,whenCreated,office

And then I see footech's.   also very interesting/nice.
0
Webinar: What were the top threats in Q2 2018?

Every quarter, the WatchGuard Threat Lab releases an Internet Security Report that describes and analyzes the top threat trends impacting companies around the world. Are you ready to learn more about the top threats of Q2 2018? Register for our Sept. 26th webinar to learn more!

Jody DavisSystems EngineerAuthor Commented:
These are all great. I took the first one and ran with it, so i'll go with the first - HOWEVER - make sure to remove the ' after the csv at the end of the script. It will of course fail otherwise. Thanks guys!
0
Jody DavisSystems EngineerAuthor Commented:
I went with the first and after removing the ' it worked great. thanks guys!
0
FOXActive Directory/Exchange EngineerCommented:
Jody- Pardon me.  I missed the quote before the c- it should have read:
 Export-Csv 'c:\temp\results.csv' -notypeinformation
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
Powershell

From novice to tech pro — start learning today.