Wednesday, 8 April 2015

PowerShell - Convert Large Integer value to DateTime string

If you are working with Active Directory, you should have come across the attributes like LastLogonTimestamp. This LastLogonTimestamp attribute is stored in the Active Directory database as a Large Integer (TimeStamp) value so we need to convert it to a normal date format string to make it readable.

Use the following PowerShell command to Convert Large Integer value to Date Time string

$lastLogonTimestamp = "130724281432636780"
[DateTime]::FromFiletime([Int64]::Parse($lastLogonTimestamp))
PowerShell - Convert Large Integer value to Date Time string

Advertisements
Advertisements

No comments:

Post a Comment