supersonic Posted December 4, 2008 Posted December 4, 2008 Hello... I'm using ADFUNCTIONS.AU3 for querying our AD. Some entries - just like 'lastLogonTimestamp' - are "binary encrypted". I found a VBS-Script that works pretty well. Can anyone help me converting the script into AU3...? Greets, -supersonic. expandcollapse popupOption Explicit Const ADS_SCOPE_SUBTREE = 2 Dim objRootDSE Dim objConnection, objCommand, objRecordSet Dim UserDN, objUser, strDNSDomain, strQuery Dim objLogon, strWeeks, strDays, intLogonTime Dim intLLTS, intReqCompare, ADVersion 'ADVersion = "2003" ADVersion = "2000" ' Determine DNS domain name from RootDSE object. Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("defaultNamingContext") ' Use ADO to search Active Directory for all Users. Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection objCommand.Properties("Page Size") = 1000 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE strQuery = "SELECT distinguishedName FROM 'LDAP://" & strDNSDomain & "' WHERE objectCategory = 'User'" objCommand.CommandText = strQuery Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF UserDN = objRecordSet.Fields("distinguishedName").Value Set objUser = GetObject("LDAP://" & UserDN) ' Begin calculation If ADVersion = "2003" Then set objLogon = objUser.Get("lastLogonTimeStamp") Else set objLogon = objUser.Get("lastLogon") End If intLogonTime = objLogon.HighPart * (2^32) + objLogon.LowPart intLogonTime = intLogonTime / (60 * 10000000) intLogonTime = intLogonTime / 1440 intLLTS = intLogonTime + #1/1/1601# strDays = strWeeks * 7 intReqCompare = Now - strDays If intLLTS < intReqCompare Then wscript.echo Mid(objUser.Name,4) & " last logged on at " & intLLTS End If objRecordSet.MoveNext Loop
PsaltyDS Posted December 4, 2008 Posted December 4, 2008 Hello...I'm using ADFUNCTIONS.AU3 for querying our AD.Some entries - just like 'lastLogonTimestamp' - are"binary encrypted". I found a VBS-Script that workspretty well. Can anyone help me converting the scriptinto AU3...?Greets,-supersonic.It's not 'encrypted', just 'encoded', which is not the same thing. A forum search for lastLogon would turn up various conversions. One even posted by a very handsome antarctic water fowl. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now