Alex Rivera | Logout

Determining how long the user is logged on to Windows

Asked 2008-08-17T10:22:25.877
10

The need arose, in our product, to determine how long the current user has been logged on to Windows (specifically, Vista). It seems there is no straight forward API function for this and I couldn't find anything relevant with WMI (although I'm no expert with WMI, so I might have missed something).

Any ideas?

Edit
Report

1 Answer

1

In WMI do: "select * from Win32_Session" there you'll have "StartTime" value.

Hope that helps.

answered 2008-08-17T10:33:36.400

Your Answer