How to find users or object added to AD i.e. the last 48 hours?

How to find users added to AD i.e. the last 48 hours? I have found som PowerShell scripts on the net, but they dont seem to work. It also would be nice to be able to see which objects have been changed the last 48 hours.
Per JacobsenSystem TechnicianAsked:
Who is Participating?
 
SilverwolfSenior Server EngineerCommented:
Here is a real simple one.....which I like simple.

$When = ((Get-Date).AddDays(-2)).Date
Get-ADObject -Filter {whenCreated -ge $When} -Properties * | Select Name, WhenCreated, CanonicalName | export-csv C:\Adobjects.csv -notypeinformation
1
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
Import ActiveDirectory
$changesAfter = (get-date).AddHours(-48)
Get-ADObject -Filter 'whenchanged -gt $changesAfter' | Group-Object objectclass

Open in new window

2
 
Sara TeasdaleCommented:
Pretty easy with PowerShell:
Powershell

$When = ((Get-Date).AddDays(-30)).Date
Get-ADUser -Filter {whenCreated -ge $When} -Properties whenCreated

Pretty much the same thing for groups:
Powershell

$When = ((Get-Date).AddDays(-30)).Date
Get-ADGroup -Filter {whenChanged -ge $When} -Properties whenChanged


There are some AD audit freeware edition tools out there that are free. Not sure about alerts, but you may be able to do something with task scheduler and event viewer if you audit AD events.

http://www.manageengine.com/products/active-directory-audit/download-free.html

www.netwrix.com/active_directory_auditing.html
1
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

 
Per JacobsenSystem TechnicianAuthor Commented:
The server is a Windows 2008 R2 and it is the DC holding the FSMO roles.

I tried that, but get an error, I may be an PowerShell noob, what am I doing wrong?

PS C:\Users\Administrator.XXXXXX> $When = ((Get-Date).AddDays(-30)).Date
PS C:\Users\Administrator.XXXXXX> Get-ADUser -Filter {whenCreated -ge $When} -Properties whenCreated
The term 'Get-ADUser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:11
+ Get-ADUser <<<<  -Filter {whenCreated -ge $When} -Properties whenCreated
    + CategoryInfo          : ObjectNotFound: (Get-ADUser:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
0
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
You need
Import ActiveDirectory

Open in new window

as per #a42518315
0
 
Per JacobsenSystem TechnicianAuthor Commented:
I start to feel a little stupid, I just get.:

PS C:\> Import ActiveDirectory
The term 'Import' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spel
ling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:7
+ Import <<<<  ActiveDirectory
    + CategoryInfo          : ObjectNotFound: (Import:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
0
 
SilverwolfSenior Server EngineerCommented:
It needs to be: import-module ActiveDirectory
0
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
Sorry, was typing from memory
1
 
Naveen SharmaCommented:
Check this article to get a list of Active Directory user accounts created in last 24 hours. In order to get an in-depth view of the changes for answering the who, what, when and where questions of change auditing - configure the Monitoring of AD Objects in Windows Server: https://www.lepide.com/how-to/enable-auditing-of-ad-objects-in-windows-server-2012.html

Else, try Active Directory auditing solution:
https://www.lepide.com/lepideauditor/active-directory-auditing.html
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.