I have a new script for Storefront 1912 CU1. Click here for the new script.
I have updated my script for testing Citrix Storefront or Netscaler and Storefront. The previous versions can be found here and here. I have modified the script so it handles errors better as well as added support for Storefront 3.11 and Netscaler 11.x.
I have tested the script with Internet Explorer 11 and Citrix Receiver 14.2 - 14.4.1 on Windows 7 x64 and Windows 10 x64.
The script attempts to closely resemble what an actual user would do by:
- Opening Internet Explorer.
- Navigates to the Receiver for Web site or Netscaler Gateway portal.
- Entering a Username and Password.
- Clicking on the Log on button.
- Clicking on the Published Application(s).
- Logging off the StoreFront site.
You can use this script to confirm your most important Published Application(s) launch correctly and in a timely manner.
You can use this Script to verify that each of your servers is responding correctly, as well. To do this you will need to Publish an Application from each server. For example, you could publish Task Manager (taskmgr.exe), from each server, and name it something like "Server 1 Task Manager", "Server 2 Task Manager", etc, etc.
The script has the ability to send an email along with the log file when an error is encountered. The email body will contain the error message(s) and the log file which basically documents each step and where the error occurred.
Script Requirements:
- Citrix Receiver installed in the default location.
- Must be launched from an Elevated Administrator console of PowerShell x86. The 64 Bit Powershell will not work since the script is using Citrix Receiver, which is 32 bit, to verify a launch and logoff the session.
- No other XenApp/XenDesktop sessions should be connected/running before running the script.
- SiteURL should be part of the Intranet Zone (or Internet Zone at Medium-Low security) in order to be able to download AND launch the ICA file without interaction. This can be done through a GPO or locally.
- Requires Citrix StoreFront, version 2.0 through 3.6 or NetScaler Gateway, version 9.3 through 11.1.
- Requires autoLaunchDesktop to be set to false.
- Requires the pluginAssistant to be set to false.
- Currently works for desktops or already subscribed apps only.
- You can auto subscribe users to apps by setting "KEYWORDS:Auto" in the published app's description or make sure the apps have been subscribed to manually.
- In order for the script to interact with the ICO, the script modifies the required changes 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
Create some Apps to use with the Script:
The first thing you should do is to publish the Application (or Desktop) and assign it to your test user.
If you want to test each server, then you need to publish an Application (or Desktop) from each server and assign it to your test user. What I mean by that is; if you have five servers, you will need to publish the App or Desktop five times, one for each server. In this scenario I am not testing load balancing, I am testing to make sure each server launches the application correctly and within an acceptable time frame.
I chose Task Manager for my testing, but it can be any Application, such as Command Prompt. The more lightweight the Application the better, you do not want to put extra strain on your servers.
You can also use a Published Desktop but Desktops are more resource intensive and take a little longer to launch since it initializes the Explorer shell. If you choose a Desktop you may need to extend the wait times, especially for the Log off command by adding -TimeToWaitForLogoff to the command line. By default this is set to 30 seconds and a Desktop may not logoff within 30 seconds. Overall, I have noticed that using a Desktop can be problematic. It is not so much an issue with the Server but with CDViewer on the client. So I recommend using Task Manager or Command Prompt for the test.
Subscribe to Apps:
The Apps need to be visible in order for the Script to launch them. You will need to log in to Storefront, as the Test User, manually and subscribed to the Apps. Alternatively, you can auto subscribe the Apps by setting "KEYWORDS:Auto" in the published app's description.
Schedule the Task:
My Scheduled Task's Action looks like this:
Program/Script:
%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe
Add arguments:
-executionpolicy bypass -file c:\CitrixScript\SFLauncher36.ps1 -SiteURL "https://citrix.domain.com" -UserName "domain\TestUser" -Password "TestUserPassword" -smtpServer "smtp.server.domain" -emailFrom "XenAppMon@domain.com" -emailTo "email@domain.com" -LogFilePath C:\CitrixScript -LogFileName SFLauncher.log "App1" "App2"
Start in:
C:\CitrixScript
Security options:
The user account needs to be an administrator on the client so PowerShell can be elevated. This does not need to be the Test User used in the script to connect to XenApp/XenDesktop.
Use the option "Run whether user is logged on or not" and "Run with highest privileges".
Command Line Notes:
The Application(s) to be launched need to be at the end of the command line, separated by a space, like this: "App Server1" "App Server2"
Testing from a Command Prompt:
If you want to test before Scheduling, open a Command Prompt as an Administrator (right click and choose "Run as Administrator")
To test the script, here is a sample command line:
%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file c:\CitrixScript\SFLauncher36.ps1 -SiteURL "https://citrix.domain.com" -UserName "domaain\TestUser" -Password "TestUserPassword" -smtpServer "smtp.server.domain" -emailFrom "XenAppMon@domain.com" -emailTo "email@domain.com" -LogFilePath C:\CitrixScript -LogFileName SFLauncher.log "App Server1" "App Server2"
Here is a Screenshot of what the script looks like while it is running:
SFLauncher3.ps1:
Link to file: SFLauncher36.ps1