{"id":378,"date":"2014-10-28T16:00:24","date_gmt":"2014-10-28T20:00:24","guid":{"rendered":"http:\/\/adsecurity.org\/?p=378"},"modified":"2014-10-28T22:22:11","modified_gmt":"2014-10-29T02:22:11","slug":"powershell-code-convert-integer8-to-date","status":"publish","type":"post","link":"https:\/\/adsecurity.org\/?p=378","title":{"rendered":"PowerShell Code: Convert Integer8 to Date"},"content":{"rendered":"<p>There are several Active Directory attributes where the value is stored as an Integer8 value.<br \/>\nThese include:<\/p>\n<ul>\n<li>accountExpires<\/li>\n<li>badPasswordTime<\/li>\n<li>lastlogon<\/li>\n<li>lastlogontimestamp<\/li>\n<li>pwdLastSet<\/li>\n<\/ul>\n<p>Here&#8217;s <a href=\"http:\/\/www.rlmueller.net\/Integer8Attributes.htm\">information on what Integer8<\/a> is:<\/p>\n<blockquote><p>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.<\/p>\n<p>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.<\/p><\/blockquote>\n<p><strong>Quick PowerShell code for converting Integer8 into a date\/time value:<\/strong><\/p>\n<p><em>$Integer8 = &#8220;130567517440984934&#8221;<\/em><br \/>\n<em> [datetime]::FromFileTimeUTC($Integer8)<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are several Active Directory attributes where the value is stored as an Integer8 value. These include: accountExpires badPasswordTime lastlogon lastlogontimestamp pwdLastSet Here&#8217;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 &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/adsecurity.org\/?p=378\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[20,187,188,22],"class_list":["post-378","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-activedirectory","tag-integer8","tag-lastlogontimestamp","tag-powershellcode","item-wrap"],"_links":{"self":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=378"}],"version-history":[{"count":1,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/378\/revisions"}],"predecessor-version":[{"id":379,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/378\/revisions\/379"}],"wp:attachment":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}