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 12:49 PM


Subscribe on YouTube