Problem solve Get help with specific problems with your technologies, process and projects.

Using C#, what is the best way to convert the last computer logon/logoff properties into a meaningfu

I am using C# to develop a program that will identify the last time a computer (not user) was logged onto the domain. My question here is two fold.

First of all, I need to know the best way to convert the last logon/logoff properties into a meaningful date/time format? How can I do this? I have read some pieces concerning how to do it in VB, but they never seemed to work in C#.

The second part of the question is: what do the last logon/logoff properties for Active Directory computers really tell you? More to the point, when is that property set? Is it set when the computer is turned on and cleanly shut down, or is there some other mystical point at which this occurs?
Interestingly, I'm hearing more and more about developers wanting to take advantage of Active Directory. The value returned by the last logon/logoff properties are the number of seconds since 00:00:00 January 1, 1970 UTC. Since the time is a large set of bits, you can look at the source code to the ctime function to see how to break it up.

Dig Deeper on C# programming language

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.