Skip to content

How to Get a List of Active Directory User Accounts Created in Last 24 hours?

You can use PowerShell to get a list of Active Directory user accounts that were created in the last 24 hours by following these steps:

  1. Open PowerShell on your domain controller or a computer with the Active Directory PowerShell module installed.
  2. Run the following command to import the Active Directory module:
Import-Module ActiveDirectory
  1. Run the following command to retrieve a list of user accounts created in the last 24 hours:
$last24hours = (Get-Date).AddDays(-1)
Get-ADUser -Filter {Enabled -eq $True -and whenCreated -ge $last24hours} -Properties Name, SamAccountName, whenCreated | Select-Object Name, SamAccountName, whenCreated

This command retrieves all enabled user accounts created in the last 24 hours and returns the “Name,” “SamAccountName,” and “whenCreated” attributes in a table format.

You can export this information to a CSV file by appending the following command to the end of the previous command:

active directory auditing solutions
ManageEngine Applications Manager
Export-CSV -Path "C:\Users\username\Documents\users_created_last24hours.csv" -NoTypeInformation

Replace “C:\Users\username\Documents\users_created_last24hours.csv” with the path and filename of the CSV file you want to create.

This will create a CSV file with the list of users created in the last 24 hours in the specified location.