Disclaimer: This article deals with Citrix XenApp 6 and above only. PowerShell cmdlets are available for XenApp 5.0 on Windows Server 2003 and 2008; however, the cmdlets are CTP (Community Technology Preview) and will likely never get “officially” released. The cmdlets in XenApp 5 are not always the same as the cmdlets in XenApp 6.
Have you ever had the need to update a lot of Citrix XenApp published application properties at the same time? For instance, suppose you publish all your Citrix XenApp applications with sound disabled. Then, somebody comes up to you and says “hey, we need to have all our applications support sound. Thanks.” If the only tool you had to use was the Citrix console, you will probably get carpal tunnel syndrome from all the mouse clicking you will need to do. Luckily, the management console is not your only tool to solve this dilemma. By using PowerShell and the Citrix XenApp 6 PowerShell cmdlets, this task is reduced to a single command.
Updating all Citrix XenApp 6 Published Applications with PowerShell
Note: if you haven’t already done so, you need to install the Citrix XenApp 6 PowerShell SDK to use the XenApp PowerShell cmdlets. Refer to this post for more information.
The following command will set every published application in the farm to have an audio type of Basic:
Set-XAApplication * -AudioType Basic
To break this down some more:
- Set-XAApplication will set a property on any application
- The * is the search string to match. If you wanted to match any application that started with test, you could use test*.
- -AudioType is the property we are setting. In this case, AudioType is an enumeration. AudioType can be set to Unknown, None, or Basic
To see a list of all the properties that can be set on a XenApp published application, check out the help file that comes with the XenApp 6 PowerShell SDK, use Get-Member in PowerShell, or check out this page.
Updating Citrix XenApp 6 Published Applications in a Folder
If you only wanted to update some publised applications in a particular folder, you can first select all applications in a folder and then pass those application objects to the Set-XAApplication cmdlet like so:
Get-XAApplication –FolderPath Applications/Testing | Set-XAApplication –PassThru –AudioType Basic
Breaking it down:
- Get-XAApplication gets a collection of XenApp applications
- -FolderPath lets Get-XAApplication know that we just want to get applications in a particular folder
- Applications/Testing is the folder that holds the applications we want.
- We then pipe (using the pipe ‘|’ character) all these XenApp application objects into the Set-XAApplication cmdlet (the same cmdlet we used above)
- This time, we use the –PassThru parameter to let Set-XAApplication cmdlet know that we are not going to search for some applications, but instead we are going to pass one or more XenApp application objects to it.
- The rest of the parameters are the same as above
There you have it. We have now set a property for all applications using one command, as well as set application properties using selection criteria. Hope this helps you out with your XenApp environment.