1

I want to know at which hour I logged in to my current session, I don't think uptime in Task Manager is what I'm looking for, because based on my understanding uptime is not the same as current user logged in time.

Is there any PowerShell command I can use in Windows to determine how long I have been logged in to the current session?

Task manager screenshot

Above is the image of my task manger, how can up time be 7 days? I dont understand.

5
  • You're correct, system uptime is an entirely different kettle of ghoti from user logged-in time. For a thorough explanation of Task Manager Up Time, see this answer on similar question. Apr 5, 2023 at 18:03
  • 1
    ... and searching for something entirely unrelated this popped up on the side panel of a site :-D winbuzzer.com/2021/03/12/… Apr 5, 2023 at 18:06
  • 1
    'uptime' is essentially a unix construct. It doesn't care how much you've been active at the computer, or how much time it slept. It simply measures 'time since last reboot'.
    – Tetsujin
    Apr 5, 2023 at 18:16
  • 1
    Are you trying to find out how long since the PC has been turned on or how long since the user logged in? Those are two different questions in your title and body, it's confusing.
    – MC10
    Apr 5, 2023 at 18:21
  • I usually look in the security log for entries ID: 4624 where the Login Type is 2 . learn.microsoft.com/en-us/windows/security/threat-protection/… Apr 5, 2023 at 20:28

1 Answer 1

5

query

Note: query.exe requires Windows 10 Pro and higher, and does not exist on Windows 10 Home. See this question for more information: How to get query command on Windows 10

You can run the command query user to find how long your user session has been logged in for. There is also a shorter quser (thanks @Destroy666!). Works in both CMD or PowerShell.

Use LOGON TIME to find out when you logged in and calculate from there.

PowerShell screenshot

net

You can also run the net stats workstation command. It will show you Statistics since ... the time you logged in.

CMD screenshot

4
  • 3
    This also works as shorter quser and it doesn't require PowerShell as it's just an executable located in C:\Windows\System32
    – Destroy666
    Apr 5, 2023 at 18:42
  • Good to know, thanks! PowerShell is in the example since OP mentioned they wanted to use PowerShell, but yes it's not required.
    – MC10
    Apr 5, 2023 at 18:45
  • quser is not present in all the versions of windows it not in home version Apr 6, 2023 at 4:56
  • @Yanjan.Kaf. I see, yeah query is only available in Windows 10 Pro and higher. Does Windows 10 Home have access to the net command? You can try net stats workstation
    – MC10
    Apr 6, 2023 at 5:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .