Get AdUser Creation Date

The Get-AdUser cmdlet in PowerShell has whenCreated property that provides the date and time of active directory user account was created.

In this article, we will discuss how to use the Get-AdUser cmdlet to get aduser creation date, how to get aduser created between dates and get ad user by Creation date in PowerShell.

Use the Get-Member cmdlet to get Get-AdUser full list of properties, methods, and members.

Get-AdUser -Filter * -Properties * | Get-Member

The output of the above command will list aduser all properties and methods available.

Get AdUser Creation Date

To get creation date of aduser, we will be using whenCreated properties.

Syntax to get aduser create date is

 Get-ADUser <username> -Properties whenCreated | Select Name,whenCreated

Let’s understand with an example to get aduser account creation date as below

 Get-ADUser Toms -Properties whenCreated | Select Name,whenCreated

In the above PowerShell script example,

it will return Toms active directory user account creation date.

The output of the above command is as given below

Get AdUser Creation Date
Get AdUser Creation Date

Get-AdUser Creation Date using ADUC

You can get active directory user account creation date using Active Directory Users and Computers ( ADUC) snap-in. It provides a GUI interface to manage users, groups, and computers.

Follow the below steps to know when was the active directory user account was created

  • Click on Start menu >> Select Run
  • Type dsa.msc and hit enter
  • It will open Active Directory Users and Computers mmc snap-in
  • Select OU >> Select User >> Right click on User >> click Attributes editor
  • Scroll down in attributes editor for whenCreated property

For example, in the below example, it gets the creation date for ad user Aron.

Get-AdUser Creation Date using ADUC
Get-AdUser Creation Date using ADUC

Note: In the large-scale active directory, using ADUC to get an aduser creation date is very tedious. Prefer the PowerShell script to get all ad user creation dates.

Get all Ad User Creation Date

You can get all ad user creation date using the get aduser filter parameter and whenCreated property.

get aduser filter * parameter gets all active directory users. Use the below command to get all aduser creation dates and ad users sort by creation date

Get-ADUser -Filter * -Properties * | Select Name, whenCreated | Sort-Object whenCreated

The above command gets the creation date for all active directory users. It gets aduser sort by creation date using Sort-Object as given below

PS C:\Windows\system32> Get-ADUser -Filter * -Properties * | Select Name, whenCreated | Sort-Object whenCreated

Name        whenCreated
----        -----------
Guest       7/29/2021 7:07:44 PM
krbtgt      7/29/2021 7:08:27 PM
Tom Smith   7/30/2021 1:08:57 PM
Erick Jones 7/30/2021 1:12:08 PM
Gary Willy  8/1/2021 2:59:29 PM
Chris Dore  8/1/2021 3:36:53 PM
adam        8/3/2021 2:45:13 PM
nathan      8/3/2021 3:34:38 PM
Don         8/3/2021 4:21:02 PM
Esh Deol    8/9/2021 4:25:18 PM
Tira Elsa   8/9/2021 4:50:30 PM
Aron Seth   8/18/2021 3:14:53 PM

Cool Tip: How to find a list of adusers passwords never expires!

Get AdUser Created between dates

You can find an active directory user accounts created within x days using the date manipulation and comparing it with the aduser creation date.

For example, to get an aduser created in the last 30 days, run the below command

$prvDate = ((Get-Date).AddDays(-30)).Date
Get-ADUser -Filter {whenCreated -ge $prvDate} -Properties whenCreated | Select Name, whenCreated | Sort-Object whenCreated

In the above PowerShell script,

$prvDate variable contains 30 days before the date, calculated using the current date and add -30 days to it.

In the second command, it uses the Get-AdUser filter parameter to get all ad users creation date was greater than 30 days and returns the list of ad user sort by creation date.

Conclusion

I hope the above article is helpful to you to get aduser creation date using Get-AdUser whenCreated property and using the get-aduser filter parameter to filter aduser objects.

We have discussed how you can get all aduser accounts by creation date and sort by creation date.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Leave a Comment