PowerShell Code: Convert Integer8 to Date

There are several Active Directory attributes where the value is stored as an Integer8 value.
These include:

  • accountExpires
  • badPasswordTime
  • lastlogon
  • lastlogontimestamp
  • pwdLastSet

Here’s information on what Integer8 is:

Many attributes in Active Directory have a data type (syntax) called Integer8. These 64-bit numbers (8 bytes) often represent time in 100-nanosecond intervals. If the Integer8 attribute is a date, the value represents the number of 100-nanosecond intervals since 12:00 AM January 1, 1601. Any leap seconds are ignored.

In .NET Framework (and PowerShell) these 100-nanosecond intervals are called ticks, equal to one ten-millionth of a second. There are 10,000 ticks per millisecond. In addition, .NET Framework and PowerShell DateTime values represent dates as the number of ticks since 12:00 AM January 1, 0001.

Quick PowerShell code for converting Integer8 into a date/time value:

$Integer8 = “130567517440984934”
[datetime]::FromFileTimeUTC($Integer8)

(Visited 11,162 times, 1 visits today)