Hello to start off i have a VBScript not VB. I am not sure where it goes but I figured this would be a good place to start.
So I am querying AD to pull the Last Data an individual set their password. I have that working just fine but I have ran into a snag where not all individuals have a Last Password Set value. My code that I have to convert big integer into date handles the value which is null or to be more specific does not exist. However it returns the wrong date, I know its the wrong date because I have had individuals reset their password to confirm that its not an actual reset issue.
I am using a standard aDODB connection into AD and this is how i am pulling the Password Set Value
Below is the large integer code
Now here is the kicker 3 days ago i had found a module that did this and actually accounted for the null value and worked. I lost it and have not been able to recover the actual value. Anyone have any suggestions.
So I am querying AD to pull the Last Data an individual set their password. I have that working just fine but I have ran into a snag where not all individuals have a Last Password Set value. My code that I have to convert big integer into date handles the value which is null or to be more specific does not exist. However it returns the wrong date, I know its the wrong date because I have had individuals reset their password to confirm that its not an actual reset issue.
I am using a standard aDODB connection into AD and this is how i am pulling the Password Set Value
Code:
Return Value for Password Last Set set objDate = adoRecordset.Fields("pwdLastSet").Value strPwdLastSet = Integer8Date(objDate,lngBias) strPwdExpDate = DateAdd("d", numDays, strPwdLastSet)
Code:
Function LargeIntegerToDate (value) '==================================================================================== ' 'REFERENCES 'http://www.selfadsi.org/ads-attributes/user-pwdLastSet.htm -doesn't handle error ' ' ' '====================================================================================== ' Function to convert Integer8 (64-bit) value to a date, adjusted for 'takes Microsoft LargeInteger value (Integer8) and returns according the date and time 'first determine the local time from the timezone bias in the registry Set sho = CreateObject("Wscript.Shell") timeShiftValue = sho.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias") If IsArray(timeShiftValue) Then timeShift = 0 For i = 0 To UBound(timeShiftValue) timeShift = timeShift + (timeShiftValue(i) * 256^i) Next Else timeShift = timeShiftValue End If 'get the large integer into two long values (high part and low part) i8High = value.HighPart i8Low = value.LowPart If (i8Low < 0) Then i8High = i8High + 1 End If 'calculate the date and time: 100-nanosecond-steps since 12:00 AM, 1/1/1601 If (i8High = 0) And (i8Low = 0) Then LargeIntegerToDate = #1/1/1601# Else + LargeIntegerToDate = #1/1/1601# + (((i8High * 2^32) + i8Low)/600000000 - timeShift)/1440 End If End Function
Comment