Hi, I have two questions, and hopefully someone will be able to answer them...
Question 1: Getting the name's of all users on a computer, I know I can use My.User.Name, but how would I get every user account that is on the computer?
Question 2: Logging of other users, I can switch users, and leave my account Logged On, although it is not active, it is faster to log back into it,
I am wondering if it is possible to log off another account, from an administrator account...?
Such as..
That won't work, as si means nothing (si = session id)
however you get the idea, I want to log off all users except for the current one,
Is that possible?
Thanks
Question 1: Getting the name's of all users on a computer, I know I can use My.User.Name, but how would I get every user account that is on the computer?
Question 2: Logging of other users, I can switch users, and leave my account Logged On, although it is not active, it is faster to log back into it,
I am wondering if it is possible to log off another account, from an administrator account...?
Such as..
VB.NET:
Dim currentProc As Process = Process.CurrentProcess()
Dim proc() As Process = Process.GetProcessesByName("notepad")
For i As Integer = 0 To proc.GetUpperBound(0)
If proc(i).SessionId <> currentProc.SessionId Then
Process.Start("shutdown", "-t 0 -si " & proc(i).SessionId)
End If
Next i
That won't work, as si means nothing (si = session id)
however you get the idea, I want to log off all users except for the current one,
Is that possible?
Thanks