09-06-20 01:50 PM
Answered! Go to Answer.
08-07-20 02:08 PM
08-07-20 02:33 PM
08-07-20 02:46 PM
08-07-20 03:26 PM
08-07-20 06:51 PM
Public Function GetLoggedInUsers() As ICollection(Of String) Dim users As New List(Of String) Dim moReturn As Management.ManagementObjectCollection Dim moSearch As Management.ManagementObjectSearcher Dim mo As Management.ManagementObject ' Retrieve a list of "explorer.exe" processes running on the system. Each logged in ' user session will have exactly one "explorer.exe" session. moSearch = New Management.ManagementObjectSearcher("Select * from Win32_Process Where name='explorer.exe'") moReturn = moSearch.Get ' Cycle through the returned process instances and get the owner of each. For Each mo In moReturn Dim arOwner(2) As String mo.InvokeMethod("GetOwner", arOwner) users.Add(arOwner(1) & "\" & arOwner(0)) Next Return users End Function
Cheers,
09-07-20 06:06 AM
09-07-20 11:55 AM