Managing a Virtual App and Desktop Environment with Powershell

In the last blog article, my co-worker shared several nice tips using the Command Line (CLI) on the Citrix ADC (formerly Netscaler). In this article, I thought I’d share a few CLI tips for Citrix Virtual App and Virtual Desktop (formerly Xen App and Xen Desktop). The CLI tips I will be sharing are more specifically Powershell cmdlets that are available to us from the Virtual App and Virtual Desktop environment. Depending on your version, there are about 820 +/- cmdlets available to us. Let’s dive in and check out just a few.

Tip #1

Frequently when I’m troubleshooting a behavior that seems to have appeared suddenly, I want to see if there have been any changes to the configuration. The Configuration Log is a great starting point. While it is easily available in the GUI, it is also a great candidate for accessing from the CLI. When we choose to export the Configuration Log from the GUI, it will prompt us with a choice of CSV, HTML, or both. With Powershell, we can easily request one or the other with the following cmdlets.

blog_03

I’ve truncated the output for clarity, but here is an example of what I found.

blog_10

This returns us some good information. In my case, it looks like a new administrator has been created recently. Seems a little odd that a user named HR1 would have been made an Administrator in my Citrix environment. That might not be the problem, but I will probably still want to follow up on that.

Exporting the same information in the HTML format requires a small change to the cmdlet.

blog_06

This will give me slightly nicer formatting but essentially the same information.

Configuration_Logging_Report

Tip #2

Another item I frequently look for when troubleshooting is the load index on my servers. A lot of you probably remember the old QFARM /Load command but know we can do that with Powershell.

blog_13

Output will look like this.

blog_16

That’s great, but sure a lot of typing to replace QFARM so let’s make a Powershell alias for our old friend.

First, I will create a function called q, then I will create the Powershell alias.

blog_19

Now I can just type qfarm. I don’t even need the /Load. Nice, even easier than before.

Tip #3

If the problem I’ve been experiencing revolves around a user and their inability to get connected to a Virtual Desktop, maybe I should quickly check the list of users for the Virtual Desktop in question.

blog_21

This cmdlet provides me with the following output that I can use to see the included users, but also any potentially excluded users.

blog_24

Well that’s enough for now. Just 816 +/- cmdlets left to explore!