Jump to content
Welcome to our new Citrix community!
  • 0

Command Line Shortcut to Logoff User Session

Joey Martinez


Hello Everyone,


I'm looking for a command-line that we can create a shortcut for.  This will allow the end-users to kill their remote app session if needed.  The application we run within ZenApps likes to crash on the end-users every now and then.  We've tried showing the users how to right-click the icon and go into the connection center to logoff their session.  However, that seems to be too difficult for a lot of our users to remember.  Ideally, we'd like to create a shortcut on the desktops for all users that when executed it will "log off" the end-users session, not disconnect.  The only command that I can find is the selfservice.exe - logoff command.  This works, but however, it only disconnects that session.  It does not log the user completely off the server.  So if they were to connect back, their application would still be locked up.  Is there another command to execute a true log off for the end-user on the farm server their connected to?


Thanks for the help in advance.



Link to comment

4 answers to this question

Recommended Posts

  • 0



I don't know of such a command's existence but I might be able to help you as to why you would want users to kill their remote app session ? I assume because they start a new session instead when clicking the icon and then cannot open certain specific application there because it's already in use in the other (disconnected) session.


If that is the case then you are better off taking away the source of the problem (people not automatically reconnecting to their existing session when clicking)

Link to comment
  • 0

Hi Joey,


I would do that with PowerShell. I don't know how you imagine thats work, should the user run this from the current Terminalserver Session or from their local Desktop.


For Example if you want to end "notepad"

Get-Process | Where-Object {$_.ProcessName -like "notepad"} | Stop-Process -Force


If you want to stop their hole Session you need this Line:

Get-BrokerSession | Where-Object {$_.Username -like $env:username} | Stop-BrokerSession


You can perform this into the Desktop Session directly (if you publish this with a nice icon). Or you can do it from their local workstation through the "Invoke-command" against the needed Terminalserver. For a User comfortable solution you will need some more lines of code, but basicly you will reach the goal with this line.


For the 2nd Command you need more Citrix Permissions in that case I would use a Service Account that runs the Command. Therefore you need some more Lines of Code...




Link to comment
  • 0

Thats true. Without Citrix Permissions you cannot run PosH Commands.


The easiest way could be the "logoff" command f.e. from the command line.


If you want to perform this with the Citrix Commands you can use "invoke-command" with -credentials. You can run it with a Service Account. The Credentials you can convert into a "Secure String".


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...