The negative value is correct, it is delta from the current time.
The 7 means there is some sort of error in the math somewhere. I don't do NET so
not sure where that could be, hopefully joek will be along shortly with the
answer there. If you just want to work with it it should be that you should be
getting
-18000000000
for the lockoutDuration value.
Divide that by 600000000 and you have your delta in minutes, -30.
joe
--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net
Ollie wrote:
> I have defined the 'Account Lockout Policy' values to be 30 minutes
> (duration & reset) in the Default Domain Security Settings in control panel
> (Domain Security Policy) of a windows 2003 machine.
>
> I am attempt to reading the 'lockoutDuration' programmatically using C#
> (.Net), the code is shown below:
>
> string nameContext = "XXXXXXXXXXX";
> System.DirectoryServices.DirectorySearcher dirSearcher = new
> System.DirectoryServices.DirectorySearcher(nameCon text);
> dirSearcher.PropertiesToLoad.Add("lockoutDuration" );
>
> System.DirectoryServices.DirectoryEntry dirEntry = dirSearcher.SearchRoot;
>
> IADsLargeInteger int64Val =
> (IADsLargeInteger)dirEntry.Properties["lockoutDuration"].Value;
> System.Int64 largeInt = int64Val .HighPart * 0x100000000 + int64Val.LowPart;
>
> System.TimeSpan ts = new TimeSpan(largeInt);
> result = ts.Minutes;
>
> The problem is the value returned is -37 minutes !!!!
>
> So I guess I have made a mistake somewhere, can anyone spot it?
>
> Cheers in advance
>
> Ollie
>
>