Jody Davis
asked on
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.
I'm not sure if this is possible. Please assist if you can. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@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,when created | ? { $_.whenCreated -le (get-date "June 1, 2015")}|Select Samaccountname,whenCreated ,office
And then I see footech's. also very interesting/nice.
Get-ADUser -Filter * -properties SamAccountname,office,when
And then I see footech's. also very interesting/nice.
ASKER
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!
ASKER
I went with the first and after removing the ' it worked great. thanks guys!
Jody- Pardon me. I missed the quote before the c- it should have read:
Export-Csv 'c:\temp\results.csv' -notypeinformation
Export-Csv 'c:\temp\results.csv' -notypeinformation
Open in new window