How to programatically find out the last login time to a machine?

前端 未结 5 965
天涯浪人
天涯浪人 2020-12-18 12:08

I would like to a) programatically and b) remotely find out the last date/time that a user successfully logged into a Windows machine (via remote desktop or at the console).

5条回答
  •  失恋的感觉
    2020-12-18 12:50

    I ended up using pInvoke for "RegQueryInfoKey" in C# to retrieve LastWriteTime on the registry key of each profile located under "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"

    https://stackoverflow.com/a/45176943/7354452

提交回复
热议问题