Virtual Insider

Blog archive

Citrix XenDesktop 5 Tip: Use PowerShell To Configure Idle Power State of Desktop Groups

Here's a PowerShell tip using the Set-BrokerDesktopGroup cmdlet to make sure the disconnect power state for VM desktop groups doesn't go right into Suspend mode.

PowerShell fever sweeping through the industry. I don't know who convinced Citrix, VMware and others that PowerShell fashion is now "in." It seems there is a race among the vendors to see who can add more in PowerShell -- if you ask me, the idea behind a GUI is that it should automate and simplify my life, so going to a command-line-based scripting interface is counterproductive and very distracting.

Sorry for the rant. Now, here's a PowerShell tip: When you build your "Random-pooled" desktop groups, you will notice that your Disconnect timer has a single action called "Suspend" that you can configure (see Fig. 1). Suspend means that after a user session has been disconnected and the disconnect timer has expired, the VM will go into "Suspend" mode.

Oh, GUI, how you mock us...

Figure 1. Without a GUI option for restarting VMs from Suspend mode, as seen here, we'll have to turn to PowerShell to shut them down and restart them back up. (Click image to view larger version.)

For many of us, Suspend is not a desirable state. Instead, we typically want to restart the VMs when the disconnect timer expires, but that setting does not exist, not even with PowerShell. So, what is the solution? It's actually a pretty easy one: Set the action to "Shutdown" and then let the power management rules dictate how many VMs are powered on. This way, at least you take it out of suspend and into a usable VM.

To activate the Shutdown setting, open PowerShell and invoke PowerShell's Set-BrokerDesktopGroup cmdlet this way:

Set-BrokerDesktopGroup yourdesktopgroupname -OffPeakExtendedDisconnectAction Shutdown
Set-BrokerDesktopGroup yourdesktopgroupname -PeakDisconnectAction Shutdown
Set-BrokerDesktopGroup yourdesktopgroupname -PeakExtendedDisconnectAction Shutdown

These commands control the Disconnected timer settings for Peak, Off-Peak and Extended Peak. Pay attention to these settings as they could make all the difference in the world when you are deploying XenDesktop and don't want to be left in a state of suspense.

Editor's Note: The article title and description were corrected after the editors introduced some errors. We apologize for the inconvenience to the writer as well as readers.

Posted by Elias Khnaser on 09/26/2011 at 6:52 PM


What is this?

Reader Comments:

Tue, Sep 18, 2012 Dan I Atlanta GA

It seems your article for got to mention setting the timers: -OffPeakDisconnectTimeout 2 -PeakDisconnectTimeout 2

Fri, Sep 30, 2011

In order to get rid of commodity tasks and in in order to deliver cost effective (cloud) services, a high level of automation is required. Powershell is nothing else than a "tool" for automation and helps as such to reduce costs by reliefing (expensive) administrators from repeating, ineffcient tasks.

Wed, Sep 28, 2011

I find the increasing return of command line tools, when combined with the continued development of a well thought out GUI, to be an intelligent and very productive move on the part of these vendors. I love a good GUI and use one as much as possible, however, I have never found a GUI that did not in some way limit the automation of tasks in some way. Command line tools allow me to create a solution for my specific needs. With a GUI I am stuck with a vendors' interpretation of what I need.

Wed, Sep 28, 2011

I love PowerShell though they should also put useful commands in the GUI.

Add Your Comment:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above