December 26, 2024

Add a Published App to XenApp using Powershell

I’m using Powershell more and more daily, and started looking at the XenApp Commands Technology Preview (v2), which are Citrix developed Powershell cmdlets to manage a Citrix environment.

To gain access to this tech preview, you will need a Citrix account.

After resetting my Citrix account password, to regain access, I logged in, and downloaded the add on for Powershell.

To be able to use this tech preview, at a minimum, you must have XenApp 4.5 with HRP3 or higher.  XenApp versions previous to 4.5 HRP3 do not have the .NET classes that the cmdlets were built against.

I am using the Citrix trial virtual appliance (XenApp 5) to test against.  I’ll be honest, I didn’t install Hyper-V, or use my Windows Virtual PC, that is included with Windows 7.  I did open the appliance with Windows Virtual PC, only long enough to create a config file for it.  I then used VMware Converter to convert it for use by VMware Workstation 7.

I powered on the newly converted VM, and performed various tasks like adding VMware Tools, removing the Microsoft equivalent, and adding the VM to my test domain, and renaming the VM to XenApp1.  I’m not going through that process here.

After installing the XenApp Commands, I figured I would try to create a new published app.  This is a 3 step process, including:

  1. Create the published application
  2. Add users/groups to the application
  3. Assign servers to the published app

To create the application I used New-XAApplication cmdlet. I’m not going to get into all the specifics of the New-XAApplication parameters, but “Get-Help New-XAApplication” will do for you if you want to know all the parameters.

So I created an application using the following code:

New-XAApplication -BrowserName “Notepad” -ApplicationType “ServerInstalled” -DisplayName “Notepad” -FolderPath “Applications/Test” -Enabled $true -CommandLineExecutable “c:windowssystem32notepad.exe” -WorkingDirectory “C:Windowssystem32” -AnonymousConnectionsAllowed $false -AddToClientStartMenu $true -InstanceLimit “-1” -WindowType “1024×768” -ColorDepth “Colors256”

That got me started, but it doesn’t provide access to the app to specific users/groups, or publish the application to a server.

To add users to the application, I used the Add-XAApplicationAccount cmdlet:

Add-XAApplicationAccount -BrowserName “Notepad” -Accounts “JASEMCCARTYjase”

To publish the application, I used the Add-XAApplicationServer cmdlet:

Add-XAApplicationServer -BrowserName “Notepad” -ServerNames “XENAPP1”

So a quick Powershell script to create, assign, and publish an application would look like this:

New-XAApplication -BrowserName “Notepad” -ApplicationType “ServerInstalled” -DisplayName “Notepad” -FolderPath “Applications/Test” -Enabled $true -CommandLineExecutable “c:windowssystem32notepad.exe” -WorkingDirectory “C:Windowssystem32” -AnonymousConnectionsAllowed $false -AddToClientStartMenu $true -InstanceLimit “-1” -WindowType “1024×768” -ColorDepth “Colors256”
Add-XAApplicationAccount -BrowserName “Notepad” -Accounts “JASEMCCARTYjase”
Add-XAApplicationServer -BrowserName “Notepad” -ServerNames “XENAPP1”

Pretty easy if you ask me.

Couple this with a Get-Content command and many applications could be published very quickly.

I look forward to the GA release of the XenApp Commands for Powershell.

4 thoughts on “Add a Published App to XenApp using Powershell

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.