‘ Logoff Disconnected Sessions
‘ If you want to logoff active sessions as well, change the query to include
‘ cActive
On Error Resume Next
Const cActive = 0
Const cDisconnected = 4
Const strComputer = “.”
Set objWMICitrix = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & strComputer & “\root\citrix”)
Set colItems = objWMICitrix.ExecQuery (“Select * from Metaframe_Session Where sessionstate = ” & cDisconnected)
For Each objItem in colItems
if (objItem.SessionID > 0) and objItem.SessionID then
objItem.Logoff
end if
Next
Set objWMICitrix = Nothing
Recent Comments