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:
- Open PowerShell on your domain controller or a computer with the Active Directory PowerShell module installed.
- Run the following command to import the Active Directory module:
Import-Module ActiveDirectory
- 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:
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.

