X

How to Get all Active Directory Users Created in the Last 24 Hours using PowerShell

You may require in some cases to check an active directory for newly created users so you can send them an email. You may also require to get newly added users for auditing or security purposes.

You can get the active directory users created in last 24 hours by using this script. Feel free to change it for 48 hours or 72 hours.

Get all Active Directory Users Created in the Last 24 Hours

Step 1. Open a text file and copy/paste the following script. Save the file with .ps1 extension.

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

Step 2. Open PowerShell with elevated privileges and execute the above script to get the user list.

Karim Buzdar: About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various websites.
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings