Solved

Citrix Powershell script help

Posted on 2012-04-04
3
1,444 Views
Last Modified: 2012-08-14
Hi Experts,

I'm trying to put a script together so I can have it logoff users who has been disconnected for more than 4 hours in Xendesktop 5. I got the following script from the example:

Get-BrokerSession -Filter { SessionState -eq Disconnected -and SessionStateChangeTime -lt '-1' } | Stop-BrokerSession

This will log off users that was disconnected for 1 day. How do I change it to 4 hours instead of 1 day? Will this script check sessions on all DDCs or only on the DDC that is running the script?

Thanks in advance for your help.
0
Comment
Question by:lo_oscar
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
Coralon earned 500 total points
ID: 37813802
You would use a get-date and compare the time..  Since the SessionStateChangeTime uses a datetime object,  it should be easy to compare the two for hours.  

In theory, it won't matter which DDC is running it, because it is querying the database, which will have information about all of the sessions.  Once a session is established the DDC is not involved with the session anymore.  

Do you have apps that won't tolerate a hard/ungraceful shutdown?  Normally, I'd just use the idle timer in the policies to handle this.

Coralon
0
 

Author Closing Comment

by:lo_oscar
ID: 37877209
I was able to figure out the script myself. But thanks for your comments.
0
 
LVL 25

Expert Comment

by:Coralon
ID: 37878015
Can you post what you came up with?  I'm curious :-)

Coralon
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

#Citrix #POC #XenDesktop #vCenter #VMware #ESX
Citrix XenDesktop 7.6 Citrix Policies Graphics
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question