Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Citrix Powershell script help

Posted on 2012-04-04
3
Medium Priority
?
1,595 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
Coralon earned 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Citrix XenDesktop, Citrix Studio, Citrix Policies, Citrix XenApp
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
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.

715 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