Sometimes, user needs to log off the sessions which are in disconnected state for more than 1 hour through powershell.
Provide the powershell script as below:
Customer can query the result and verify first.
After confirmation, the customer can terminate these disconnected sessions using the last command.
#######################################################
asnp Citrix*
#Set the Disconnected session timer interval, The unit is minutes
$timerInterval=60
#Query the Disconnected Session that meets the conditions
Get-BrokerSession|where {$_.SessionState -eq "Disconnected" -and $_.SessionStateChangeTime.AddMinutes($timerInterval) -lt (get-date)}
#Terminate the Disconnected Session that meets the conditions
#Get-BrokerSession|where {$_.SessionState -eq "Disconnected" -and $_.SessionStateChangeTime.AddMinutes($timerInterval) -lt (get-date)}|Stop-BrokerSession
#######################################################
Question on how to log off the sessions which are in disconnected state for more than 1 hour.