How to get list of all logged in users using

前端 未结 1 905
遇见更好的自我
遇见更好的自我 2020-12-11 23:48

How can I get a list of usernames and their activity times on a remote machine, using C#?

For example, if there is a Windows machine named \'ABC-PC\' and there are c

相关标签:
1条回答
  • 2020-12-12 00:32

    This query give to you all the logged users

    ManagementObjectSearcher query= new ManagementObjectSearcher("SELECT * FROM Win32_UserProfile WHERE Loaded = True");
    

    You also have other parameters like LastUseTime into Win32_UserProfile

    0 讨论(0)
提交回复
热议问题