Solved

Citrix Powershell script help

Posted on 2012-04-04
3
1,392 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 24

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 24

Expert Comment

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

Coralon
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Difference between Sccm and Citrix Xenapp 7 246
Problem to cmd 2 79
Sharing a local printer over workgroup 4 54
Windows RDS Farm 3 42
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Citrix XenDesktop 7.6 Citrix Policies Disable Peripherals
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.

912 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now