Jason CitrixADmin wrote:
I found the following script that is supposed to handle disconnected sessions, but I think it kills ALL disconnected sessions, not just those belonging to a user. Since I am not very good with scripts perhaps someone can verify, and verify that it works across morethan one server. / 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/
Hej,i've found the solution for a users leftover (reason may vary) disconnected sessions: in the line where the logoff is done:
change tokens=3 to tokens=2 logoff awaits either a session id or a session name. With tokens=2 disconnected sessions have the session id, active sessions have the session name.one more: i've stumbled upon an error when using "query user" and whitespace in the username. Switching to quser has fixed that for at least Srv 2003 R2. Weird but working
cheers, Marcus
Hej, first: many thanks, i've seen the script, tested and deployed it. As icon the red Powerbutton from Shell32.dll, a descriptive name - no room left for questions like "What's that for". One Question / an observation i made: what about disconnected sessions? As far as i've seen they aren't logged off. cheers, Marcus
************************************************For Archives, RSS, to Unsubscribe, Subscribe or set Digest or Vacation mode use the below link:
//www.freelists.org/list/thin ************************************************