DESCRIPTION
This script translates dates stored in long integer format. It has been tested for accuracy against the "lastLogonTimestamp" and "lastLogon" attributes. It will, most likely, work against other similarly formatted date attributes. The domain must be in Windows 2003 native functional mode for the "lastLogonTimestamp" attribute to be populated and replicated.
Note This code may use functions from the ARS Script Policy Best Practices. Please, follow the link to obtain instructions and code for those functions.
SCRIPT
'*********************************************************************************
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
' WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
' PLEASE CONTACT QUEST PROFESSIONAL SERVICES.
'*********************************************************************************
'
' This code is published on the ActiveRoles Script Center:
' http://communities.quest.com/docs/DOC-9991
'
' This code may use functions from the ARS Script Policy Best Practices:
' http://communities.quest.com/docs/DOC-10016
'
' Please, follow the link to obtain instructions and code for those functions.
'*********************************************************************************
' Choose a provider to make the binding with:
Set objUser = GetObject("LDAP://CN=Administrator,CN=Users,DC=LAB,DC=TLD")
'-or-
'Set objUser = GetObject("LDAP://CN=Administrator,CN=Users,DC=LAB,DC=TLD")
objUser.Getinfo
' Select an attriubte to view:
Set objLastLogon = objUser.Get("lastLogonTimestamp")
' -or-
'Set objLastLogon = objUser.Get("lastLogon")
' Formats the long integer format into a date and time format:
intLastLogonTime = objLastLogon.HighPart * (2^32) + objLastLogon.LowPart
intLastLogonTime = intLastLogonTime / (60 * 10000000)
intLastLogonTime = intLastLogonTime / 1440
' Displays the result:
Wscript.Echo "Last logon time: " & intLastLogonTime + #1/1/1601#
'***** END OF CODE ***************************************************************
COMPATIBILITY
Script compatible with the following version(s): <Not specified>