User stuck on Citrix Desktop, no way to force log off

You and myself included would hope not, however there may just be a day in your Citrix career when you receive a phone call from a user telling you how they cannot get logged on to Citrix or that their session has frozen and they cannot end the session.

Sure, you might try and log them off via Citrix Director or kill the session via Remote Desktop Services Manager but what if that doesn’t work? What if no matter how many times you click that reset or logoff button nothing happens? What if you try and kill every session process initiated by the user one by one but still one or more of the processes remain?

Now, you are thinking “I will have to restart the XenApp server at this stage”, but you may have 5, 10, 15, 20+ users concurrently sharing that single XenApp server! Not as simple as just restarting because now you are going to affect a larger user base.

You have two options:

  • Send all currently logged on users a message asking them to log out. All whilst doing this the affected user has to wait unproductively
  • Run a PowerShell command to hide the affected users session so that they can log on to a new session on another XenApp server

Running this PowerShell command, you will have the affected user up and running quickly and you can worry about draining and restarting the server at a more convenient time or without as much urgency.

Within Citrix Studio, launch PowerShell or add the Citrix.Broker.Admin.V2 module to your PowerShell session.

Run command Get-BrokerSession -username DOMAIN\affectedUsername | Set-BrokerSession -hidden $true

Now, run Get-BrokerSession -username DOMAIN\affectedUsername and you can see the Hidden flag will now be set to True. This has set the affected users broken session as hidden. At this stage, the user can launch a Desktop from receiver and it should connect to a different desktop hosting machine in the pool without any fuss.

1

 


15 Comments

  • Dwayne La Rose

    October 4, 2016

    heheh you saved our bacon! I am sticking this in my evernote. I would like to add that using powershell via the Citrix Studio console worked for me.

    Reply
  • George Spiers

    October 4, 2016

    Yes that’s an easier way of launching PowerShell with the correct snapins 🙂 Nice one!

    Reply
  • Siva

    November 16, 2016

    Thank you so much for this post. I just wished Citrix Support had known this. Asked for this multiple times.

    Reply
    • George Spiers

      November 16, 2016

      You’re welcome!

      Reply
  • Admin

    November 21, 2016

    Oh thank you!! I wished I found you earlier – but still applies!!

    Reply
  • Patrice Jacques-gustave

    January 6, 2017

    Hello,

    Your post is very hepfull, I translate it in my website for french people, thank a lot

    Reply
  • Mario

    April 11, 2017

    You saved my days! Thanks a lot!

    Reply
  • keith

    April 13, 2017

    Will this work for 6.5?

    Reply
    • George Spiers

      April 13, 2017

      Nope only 7.x

      Reply
  • abhishek

    May 26, 2017

    what if i want to kill the hung session rather than keeping it hidden?

    Reply
    • George Spiers

      May 26, 2017

      Making it hidden is just a workaround until you can restart the server. Ultimately to kill the hung session you reboot the VDA once it has drained of users.

      Reply
  • Pablo

    August 30, 2017

    Hi George,
    Thanks for your post !!
    On my environment, 7.6 work add quotation marks to DOMAIN\affectedUsername

    Run command Get-BrokerSession -username “DOMAIN\affectedUsername” | Set-BrokerSession -hidden $true

    Reply
    • George Spiers

      August 30, 2017

      Thanks for the feedback.

      Reply

Leave a Reply