Reputation: 1407
Does Windows XP (and up) store how long it has been...
Thanks.
Upvotes: 1
Views: 3596
Reputation: 75982
You can use the LsaGetLogonSessionData
to get the data about a particular logon session, including the time the session was started. To call that method you need a LUID - a logon session ID. You can get the list of current logon sessions LUIDs using LsaEnumerateLogonSessions
.
If you are looking for the data for a particular user, you can look at the UserName member of the SECURITY_LOGON_SESSION_DATA
structure returned by
LsaGetLogonSessionData
.
Edit: To get the time since the system was started, use GetTickCount64(), as @jeffamaphone mentioned.
The others you can calculated from the difference between the SECURITY_LOGON_SESSION_DATA.LogonTime
and the current time.
Upvotes: 2
Reputation: 1296
On the terminal run systeminfo
Example:
C:\WINDOWS>systeminfo
Host Name: ...
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 2 Build 2600
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Registered Owner: ...
Registered Organization: ...
Product ID: ...
Original Install Date: 17/04/2009, 10:23:23 AM
System Up Time: 0 Days, 0 Hours, 51 Minutes, 11 Seconds
System Manufacturer: Dell Inc.
(etc...)
I believe there may be other ways also to find such info. For example, PCWizard shows some more detailed info about install date, boots since install, uptime, time since logon, etc.
Upvotes: 4
Reputation: 54600
GetTickCount() does what you want, though it wraps-around every 49 days or so. So, yeah, use GetTickCount64().
Upvotes: 1
Reputation:
You can see when the system started by typing the following into a command prompt
net statistics workstation
You'll get output like this
Workstation Statistics for \\LAPTOP
Statistics since 8/31/2009 8:50:10 PM
Upvotes: 1