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 Powershell
-
Get-AdUser PwdLastSet - Get Aduser Last Password Change
-
Efficiently Converting Pwdlastset To Datetime In A Single Line.
-
Converting Pwdlastset To Datetime Datatype Not Working From Hash ...
-
Powershell Output Of Ad-user PwdLastSet And LastLoginTimeStamp
-
PowerShell Code: Convert Integer8 To Date - Active Directory Security
-
Powershell: How Do I Query PwdLastSet And Have It Make Sense?
-
Convert Int64 TimeStamp To DateTime In Powershell
-
LDAP, Active Directory & Filetime Timestamp Converter
-
Active Directory Powershell: Quick Tip LastLogonTimeStamp And ...
-
Powershell Script - Users Pwdlastset - Spiceworks Community
-
Finding Users Who Have Not Changed Their Password Recently
-
How To Find Last Password Change Date With Or Without PowerShell
-
How To Convert Active Directory TimeStamp Property To DateTime
-
Integer8 Attributes