
As an administrator, we get query that how to find users which is created in last “X” no of days. Below scripts will give output for number of users created in last 30 days
You can run the below command either on a domain controller or a member server.
- Log in to a Domain Controller.
- Import the Active Directory PowerShell module Import-Module ActiveDirectory.
- Run the below PowerShell command to find the user’s created in last 30 days.
Get-ADUser -Filter * -Properties whenCreated, description | Where-Object {$_.whenCreated -ge ((Get-Date).AddDays(-30)).Date} |select samaccountname, description | export-csv c:\temp\AdUserlast30days.csv
Categories: Microsoft, PowerShell
Leave a Reply