Using My Citrix XenApp 6.5 PowerShell Documentation Script with Remoting
I received an email from a reader wanting to get my Citrix XenApp 6.5 Farm PowerShell documentation script to work remotely. After I wrote my original script and article, Citrix updated the XenApp 6.5 PowerShell SDK to support Remoting and a Default Computer Name. Even using the new –ComputerName parameter, he was still unable to get my script to work.
Note: This article was updated on November 20, 2015. Go to the bottom of this article to see the updated information.
I installed the Citrix XenApp 6.5 PowerShell SDK and Group Policy modules on my lab domain controller. All my lab servers have the Windows Firewall enabled and Server Manager Remote Management enabled.
I found this information in the SDK help file on Remoting Cmdlets:
This section explains how to invoke the XenApp Commands remotely. In XenApp 6.5 the cmdlets can be remoted using the -ComputerName parameter. In order to facilitate running existing scripts remotely without having to make significant changes, a default computer name can be set in the client machine. To do this a new set of cmdlets was introduced. When the default computer name is set, all the cmdlets will automatically remote to the server specified without having to explicitly use the -ComputerName parameter every time. To set the default computer name: Set-XADefaultComputerName server1
My lab XenApp 6.5 server is named XA65, so I entered on my domain controller.
When I ran my documentation script, I received:
I then ran Microsoft’s Sysinternals ProcMon to get a network trace. I found that TCP Port 2513 needed to be opened (Figure 2).
My wife tells me I couldn’t find a 10 gallon (37.8541 Liter) jug of milk on the fridge’s top shelf! What does this have to do with anything? DOH! At the top of the help file, I now see (Figure 3):
The help text says TCP Port 2513 must be opened on both computers, but I found I only needed it opened on the XenApp server. To me, that is one less port open on my network.
I created a Windows Firewall Rule on my XenApp server to open TCP Port 2513 between the domain controller and my XenApp server (Figure 4). The “remoteip” will need to be the computer’s IP address used to run the script.
netsh advfirewall firewall add rule name=&quot;Citrix PoSH TCP Port 2513&quot; dir=in action=allow description=&quot;Allow communication between XenApp and remote computer running PoSH scripts&quot; enable=yes profile=any remoteip=192.168.1.100 protocol=tcp localport=2513
The Windows Firewall GUI shows my new rule created and enabled (Figure 5).
Now my script runs (Figure 6).
Now you can use my XenApp 6.5 PowerShell Documentation Script with absolutely no modifications and have it work with remoting. Thanks, Citrix, for making this so easy.
Update November 20, 2015:
If you are having an issue connecting, make sure the Citrix XenApp Commands Remoting service is started. I have seen this service in three states at various locations: Manual, Automatic but not Started, and Automatic and Started. Make sure this service is Started, and then your remote connection should succeed.
Thanks to my Aussie friend Jeremy Saunders for reminding me to update this article with this information.