Log off all users of a published app via script?, in the Citrix XenApp / Presentation Server forum on BrianMadden.com
Brian Madden Logo
Your independent source for desktop virtualization, consumerization, and enterprise mobility management.

Log off all users of a published app via script?, in the Citrix XenApp / Presentation Server forum on BrianMadden.com

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 4 Replies | 1 Follower

Not Ranked
Points 330
johns_ar posted on Wed, Feb 2 2011 6:58 PM

Hi

Just wondering if the above is possible? 

Been looking at tslogoff from www.ctrl-alt-del.com.au and obviously it can log everyone off but does anyone know if you can do it per published app with a switch?  Want to log off all users at some point during the night but we have Opera stuff running overnight calcs where we cannot have the users being logged off.

Any help greatly appreciated!

Thanks

  • | Post Points: 35

All Replies

Not Ranked
Points 100
Suggested by Haydn Davies

Hi

 

I have used a script to clear disconnected sessions from servers before, you might be able to call the application rather than the sessionstate.

I have not had a chance to play to much with it, but will try later in the week or over the weekend.

You may need to build an array list with your servers in it and get the command to cycle through all the servers.


' 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 < 65530) then
objItem.Logoff
end if
Next

Set objWMICitrix = Nothing

  • Post Points: 5
Not Ranked
Points 100
Suggested by Haydn Davies

Hi


I have used a script to clear disconnected sessions from servers before, you might be able to call the application rather than the sessionstate.

I have not had a chance to play to much with it, but will try later in the week or over the weekend.

You may need to build an array list with your servers in it and get the command to cycle through all the servers.


' 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 < 65530) then
objItem.Logoff
end if
Next

Set objWMICitrix = Nothing

  • Post Points: 20
Not Ranked
Points 330

Cheers Haydn.

 

I'll look forward to seeing if you can tweak it for a particular app Smile

  • | Post Points: 5
Not Ranked
Points 330

Hey Haydn,

 

Did you manage to get anywhere with it?

Thanks

  • | Post Points: 5
Page 1 of 1 (5 items) | RSS