UPDATE: I found trying to run this script through the Netscaler Gateway failed due to differences in the web pages. I re-wrote the script so it will work internal directly to StoreFront, and externally with Netscaler Gateway. The main caveat is that the wficalib.dll doesn’t allow you to logoff the session when going through the gateway. I simply set it to look for any wfica32 processes prior to launching the application/desktop, compare that to the processes after launch, and kill the new process (disconnecting the session). The script identifies the webpage as a gateway if */vpn/* is in the path. I also set it to logoff of the Storefront/Gateway page when it ends the script. If you were to run it back to back without logging off of the page it wouldn’t find what it is looking for initially and fail (because you’d probably already be logged on). I may re-write this in the future with more functions to make it a bit shorter/cleaner, but as is it should work.
NOTE: I tested this with Netscaler 10.5… it may not work with previous versions as is, but if you read the script you should be able to figure out what needs to be changed.
I need to give credit to this Citrix blog post for getting me started. This script will launch an application or desktop as a user you specify from the StoreFront web page, then send you an email to let you know if it was successful or not.
Variables you should edit:
In the send-results function
$smtpserver (line 19)
$msg.From (line 28)
$msg.to.Add (line 29)
In the main script (be sure to read the comments)
$username (line 84)
$passstring (line 86)
$resource (line 92)
$mask (line 94)
$wait (line 96)
$internetexplorer.visible (line 98)
$internetexplorer.navigate2 (line 99)
Requirements:
Powershell (x86)! – otherwise you cannot tie into the x86 dll for Receiver
(If you are going to the Netscaler Gateway it doesn’t matter which version as we won’t tie into the dll in that case)
Add the following to the registry if you are pointing to the internal StoreFront url – if you are pointing to the Netscaler Gateway it won’t matter
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\ICA Client\CCM]
“AllowLiveMonitoring”=dword:00000001
“AllowSimulationAPI”=dword:00000001
If you are running on an x86 machine change the registry path to exclude Wow6432Node, and change the path of the .dll on line 156 of the script to the correct path of the wficalib.dll.
Contact me in in the channel David62277