HighParts, LowParts, Low Points and (eventually) High Points.So this morning I got in early to work and realised that a couple of application user accounts were locked out.
"I know" I thought I'll write a console app to flag these up to our Helpdesk and what's more I'll do it all before the rest of my team get in, in thirty minutes time.
Sounds too good to be true, yeah, of course it was...what an idiot! I probably could have achieved this if only I was a C# programmer, but alas not, it's VB.Net for me.
Here's What I WantedA console app to check the locked out status of each each within a certain Active Directory structure OU (named Application Accounts, snazzy eh?). An added bonus would be if I could tell when the account was locked out.
Here's What HappenedAs hoped the app took only a few minutes to write, except of course the 'added bonus' which has taken me the rest of the day.
So Why The Delay?To check whether an account is locked you retrieve the lockoutTime property for a directory entry. This 'large integer' value represents the nanoseconds between 1st January 1601 and the time the account was locked out.
Large integers need to split into a HighPart and a LowPart using Reflection.
(Are you still with me? God knows this confused the hell out of me.)
All the examples I found were in C# and most included bitshifting '<<' which didn't seem to work for me.
(At this point my memory thought of '32 bits of a bus' in John Cleese's Compaq Advert.)
So I settled for copying the best bits (that is, the bits I understood) from many posts/articles and I cobbled them together giving the final result.
NOTE: I'd love to thank particular blogs, articles, people, but truth be told I've read so many articles today I wouldn't know which ones I took which bit from.