PowerShell Script to Get User Created in last 30 Days

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

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: