[UPDATE] This script will not actually alert you to errors if there is a problem with the IMA Service. Please see my latest post, Powershell Script to launch one or more Published Applications from Storefront.
Two weeks ago I had a server in my lab that would not launch an application. The event log had event 10001 listed and it read "A usable server cannot be found on which to launch the application...".
So I checked out my homegrown monitoring service (which I will blog about later on) and everything was fine. The User Load was 0, the ICA port was listening and responding correctly, the XML service was running, etc. etc., but nothing would launch. This server has been running fine for more than two years.
I did some Google-Fu and came up with some articles and forum posts. The only thing that worked for me was to remove the server from the farm, reboot and then re-join the Farm.
So, afterwards I thought it would be useful to know if there was ever an issue when launching a Published Application from one or more XenApp Servers. I wrote the following script to do just that.
I schedule it to run once per hour between 6AM and 6PM. If there is an error I get an email with a summary of the issue, including which server has an issue. I run the script on a Windows 7 VM, I did not test running it from a XenApp Server.
The Scheduled Task is setup like this:
# Program/Script: %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe
# Arguments: -ExecutionPolicy Bypass -file C:\Scripts\LaunchPublishedApp.ps1
As an additional bonus, I am also logging how long it takes to log on to each server. I am averaging 19 seconds with just Command Prompt. I utilize Citrix Profile Management on the servers so 19 seconds is pretty darn good.
In order for the script to interact with the ICO, it requires the following to be set in the registry:
x64: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\ICA Client\CCM
x86: HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client\CCM
AllowLiveMonitoring REG_DWORD 1
AllowSimulationAPI REG_DWORD 1
Let me know what you think of the script and if you know of a better way of doing this.
http://www.czerno.com/default.asp?inc=/html/Citrix/Scripts/LaunchPublishedApp.asp