TIP: Active Directory Module Date Properties - Tech Wizard
Maybe your like
We have seen, it is very easy to get values like password expiration, when created and other such values utilizing Quest Active directory Module.

You can see above; how easy it is to get this information from the Quest AD module but what about if you want the same information from Microsoft Active Directory Module.
When you do the same with AD module, whenCreated is fine but other values such as accountexpires and pwdlastset is not friendly date format.
get-aduser testuser -Properties whenCreated,accountExpires,pwdLastSet | Select Name, whenCreated,accountExpires,pwdLastSet

There are different ways to get different things in this module:
For Account Expiry Date parameter that can be used is àAccountExpirationDate
get-aduser testuser -Properties whenCreated,accountExpirationdate | select Name, whenCreated,accountExpirationdate

For user password expiry date à @{N=”PasswordExpiryDate”;E={[datetime]::FromFileTime($_.”msDS-UserPasswordExpiryTimeComputed”)}}

For user pwdLastSet à @{N=”pwdLastSet”;E={[datetime]::FromFileTimeUtc($_.pwdLastSet)}}
get-aduser testuser -Properties whenCreated,accountExpires,pwdLastSet | select @{N=”pwdLastSet”;E={[datetime]::FromFileTimeUtc($_.pwdLastSet)}}

You can do the same with account expires property as well à @{N=”accountexpires”;E={[datetime]::FromFileTime($_.accountexpires)}}
get-aduser testuser1 -Properties whenCreated,accountExpires | select Name, Whencreated, @{N=”accountexpires”;E={[datetime]::FromFileTime($_.accountexpires)}}

I hope this TIP will help you in your day-to-day AD work.
Thanks for reading…..
Tech Wizard
https://techwizard.cloud
https://syscloudpro.com/
PowerShell Fast Track
Share this:
- X
Tag » Active Directory Pwdlastset Convert To Date
-
C# - How To Convert Active Directory PwdLastSet To Date/Time
-
Efficiently Converting Pwdlastset To Datetime In A Single Line.
-
LDAP, Active Directory & Filetime Timestamp Converter
-
How To Convert Date/time Attributes In Active Directory To Standard ...
-
Converting Pwdlastset To Datetime Datatype Not Working From Hash ...
-
Get-AdUser PwdLastSet - Get Aduser Last Password Change
-
How To Convert Active Directory Timestamp To Date In Excel (4 ...
-
PwdLastSet, AccountExpires, LastLogon, Timestamp LDAP / Active ...
-
Convert Active Directory PwdLastSet Attribute To Readable Time
-
Active Directory Date Long Integer PwdLastSet Conversion - DevCentral
-
Solved: How To Convert Dates From Data Source Active Direc...
-
Convert PwdLastSet To A Human Readable Date
-
How To Convert Datetime <= To => Active Directory LDAP Win32 ...
-
How To Convert Active Directory Long Date In SDI/TDI - Forums - IBM