How to handle time …

Reading Time: 2 minutes

Handling time is somehow challenging task. It can;t be stopped so far so we have to live with schedules and clocks. But this won't be about time physics but more mundane thing.

One of my friends has asked me question how to translate pwdLastSet attribute value to some more readable value. My first answer was – what a suprise – adfind.exe. Adfind handles such things pretty well:

C:\Temp>adfind -b "CN=Administrator,CN=Users,DC=w2k,DC=pl" -s base pwdlastset -tdc

AdFind V01.37.00cpp Joe Richards ( June 2007

Using server:
Directory: Windows Server 2003

>pwdLastSet: 12/22/2005-17:18:55 Central European Daylight Time

Hmmm … but his answer to this was:

'adfind.exe' is not recognized as an internal or external command,
operable program or batch file.

Well .. if You are getting similar message it is time to change it – get adfind as soon as you can. It will make your AD-life easier. But we are still with a problem – how to translate pwdLastSet attribute value stored as  Interval to readable content using system tools or tools delivered by Microsoft (in some environment using third party tools is not something which You can do) 

So let's start with some AD pick lock which is LDP.EXE. IN version delivered with Windows 2003 and later it does this magic for us:

    1> pwdLastSet: 12/22/2005 16:18:55 Central European Standard

Next tool we can use us well known repadmin.exe with /showtime switch. What we will have to to is remove from this value 7 rightmost digits and pass it to the tool:

C:\Temp>repadmin /showtime  12779738335
12779738335 = 0x2f9bb54df = 05-12-22 15:18.55 UTC = 2005-12-22 16:18:55 local


And last tool I will mention is finally something which is at least related to time,  w32tm.exe with /ntte swithc:

C:\Temp>w32tm /ntte  127797383352618256
147913 15:18:55.2618256 – 12/22/2005 5:18:55 PM (local time)

So as You can see our toolbox for this task is pretty rich … but still, if you can grab a copy of adfind and use it. It is really great tool