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

citrix powershell doubts

Alex Heng


Hi All, 


I am currently running a powershell script to disconnect users whose session state shows disconnected and the duration is more than 8 hours using task scheduler. 


It seems that the script is running but it's not reflected in citrix studio. 


Details of script
Add-PSSnapin Citrix*
Get-BrokerSession | Where-Object {$_.sessionstate -eq "Disconnected" -and $_.SessionStateChangeTime -lt (Get-date).AddHours(-8)} | Stop-BrokerSession


When I ran directly from powershell, it's working as intended ... Not sure where have I gone wrong.


Please kindly advise. 



Link to comment

4 answers to this question

Recommended Posts

  • 0
On 8/29/2019 at 5:21 PM, Anjani Bhiravabhatla said:

Hi ,


Powershell script that you mentioned above should ideally disconnect the user sessions after the set duration . Instead you can also configure the below policy settings to terminate the disconnected user sessions .




Let us know if you need any more information regarding this .



Anjani Bhiravabhatla


Hi Anjani, 


That would be the best situation but sad to say I got no access to GPO. 


So the next best thing would be to use power shell scripts. 


I have been monitoring the results and it seems that the the sessions are not disconnected. 


Can someone please shed some light?



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...