Danny said:
For our business we need to use remote desktop.
We are using a shared account that is always logged on to Windows XP.
Several users knows the password of the logged on user, so they can
connect remotely.
But if a second user wants to connect to the session, using the same
account/password, the first user is kicked of.
Is there a way to check if the session is remotely managed?
Hi,
See if the VBScript (.vbs) below works for you.
A prerequisite for the script to work (in it's current version), is
that all computers are domain computers, and that the user account that
runs the script is directly or indirectly (through group membership)
member of the Administrators group on the remote computer.
Alternatively, look into parsing the output from Qwinsta.exe, some
script examples to be found in this Google newsgroup search:
http://groups.google.com/groups?q=Qwinsta.exe+torgeir&start=0&scoring=d
Script start:
'--------------------8<----------------------
'Change the text y10056 to your actual computer name or
'IP address.
strComputer = "y10056" ' Some computer name or IP address here
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objEnum = objWMIService.execQuery _
("select __relpath from win32_process where caption = 'explorer.exe'")
strTitle = "Logon check"
If objEnum.Count = 0 Then
MsgBox "No one currently logged in to " & strComputer & "." & vbCrLf, _
vbInformation + vbSystemModal, strTitle
Else
For Each objEntry In objEnum
Set outParams = objEntry.ExecMethod_("GetOwner")
MsgBox "User " & outParams.User _
& " is currently logged in on computer " & strComputer & "." _
& vbCrLf, vbInformation + vbSystemModal, strTitle
Next
End If
'--------------------8<----------------------