Citrix Logon Simulator

When I run the Test-Citrixapp.ps1 script manually I get an error “Username textbox not found” This is from a Windows 10 Client with Internet Explorer 11.

[10-13-2016 15:19:33.568]: Detecting NetScaler Gateway or StoreFront login form…
[10-13-2016 15:19:33.647]: Try #1: SUCCESS
[10-13-2016 15:19:33.655]: NETSCALER GATEWAY DETECTED
[10-13-2016 15:19:33.742]: Getting Login button
[10-13-2016 15:19:33.750]: Getting UserName textbox
[10-13-2016 15:19:33.761]: Getting Password textbox
[10-13-2016 15:19:33.772]: Exception caught by script
[10-13-2016 15:19:33.780]: UserName textbox not found


Any help would be appreciated as this MP would be great for our monitoring.

1 Like

At least you are getting the login button. It’s failing for us. “no logon button available”

ok update to this…

We are now able to launch an app using Powershell on our test machine but when we move it to SCOM via the json we are getting a consistent critical. Also, I’ve noticed the log file does not get written to when the SCOM agent launches it.

Is anyone ACTUALLY using this MP and have it working? I’m really skeptical now if the current build works at all.



Hi have you tried running the powershell under the service account on the client to see whats actually happening on IE session it opens?

I have this working in my production environment but it was a bit of a process

Yes the powershell script works fine manually but with the MP can’t seem to report anything but “bad” for result. There are no errors though. We did this with the service account with success. When SCOM tries to run it no log file ever gets created so I suspect there’s a path issue somewhere that’s bombing it out but again no errors.

I’m wondering if our build or version is different than maybe yours. Do you have your mp file somewhere that I could try?

This is what I'm seeing... (which launches fine when you run the mycitrixapp ps1 file manually as the service account configured in scom for the profile.

are you trying to get the log from the SCOM task or directly from the server? as there is an issue with path naming on the task, also can you send over what your config file looks like?

I guess the server. I’m not sure where I’d get it from the scom task? The log file only gets created when you run the ps1 script manually. When SCOM tries to run it on the machine the log file doesn’t get created. Here’s the json:


{ “name”:“Notepad”, “storefrontUrl”:“”, “resourceName”: “Notepad”, “logFileName”:“sflauncher.log”, “timeoutForSFLoginPage”: 30, “timeoutForSFResourcesPage”: 30, “timeoutForSessionLogin”: 60, “timeoutForOther”: 10, “interval”: 300, “syncTime”: “00:01” }


c:\Monitoring\Citrix\Logs is the path and this folder is empty. If I don’t create a “Notepad” folder in this Logs folder or an sflauncher.log file manually then I do get additional errors from the monitor. However, once I create these it doesn’t cause the log file to get updated.

Hi Gary are the properties in SCOM showing as these params? you can check these on the hosted object tile from the screenshot you sent above

I apologize David but I'm not following. Which properties in SCOM and where is the hosted object tile? Are you referring to this?

That’s the one thanks, looking at this particular the resource you are trying to test (Notepad ImageRight) has a space and this confuses the script as it adds this as a parameter so you need to insert it as string using ‘’, in your config file add its as this

“resourceName”: “‘Notepad ImageRight’”


I actually use the CSV config file (because i monitor multiple resources on one file) i’ve attached an example


Notepad-ImageRight,,'Notepad ImageRight',sflauncher.log,30,30,60,10,300,00:01

Do you mean to have a quote and an apostrophe around Notepad ImageRight?


Here is our config file (json):


For Notepad Crystal:

{ “name”:“Notepad-Crystal”, “storefrontUrl”:“https://storefront.domain.local/Citrix/domainweb”, “resourceName”: “Notepad Crystal”, “logFileName”:“sflauncher.log”, “timeoutForSFLoginPage”: 30, “timeoutForSFResourcesPage”: 30, “timeoutForSessionLogin”: 60, “timeoutForOther”: 10, “interval”: 300, “syncTime”: “00:01” }


For Notepad ImageRight:

{ “name”:“Notepad-ImageRight”, “storefrontUrl”:“https://storefront.domain.local/Citrix/domainweb”, “resourceName”: “Notepad ImageRight”, “logFileName”:“sflauncher.log”, “timeoutForSFLoginPage”: 30, “timeoutForSFResourcesPage”: 30, “timeoutForSessionLogin”: 60, “timeoutForOther”: 10, “interval”: 300, “syncTime”: “00:01” }

ye you need both as below


For Notepad Crystal:

{ “name”:”Notepad-Crystal”, “storefrontUrl”:”https://storefront.domain.local/Citrix/domainweb”, “resourceName”: “‘Notepad Crystal’”, “logFileName”:”sflauncher.log”, “timeoutForSFLoginPage”: 30, “timeoutForSFResourcesPage”: 30, “timeoutForSessionLogin”: 60, “timeoutForOther”: 10, “interval”: 300, “syncTime”: “00:01” }


For Notepad ImageRight:

{ “name”:”Notepad-ImageRight”, “storefrontUrl”:”https://storefront.domain.local/Citrix/domainweb”, “resourceName”: “‘Notepad ImageRight’”, “logFileName”:”sflauncher.log”, “timeoutForSFLoginPage”: 30, “timeoutForSFResourcesPage”: 30, “timeoutForSessionLogin”: 60, “timeoutForOther”: 10, “interval”: 300, “syncTime”: “00:01” }

Wow! It works now. Now in my logs folder I see an sfcontent.html file. Do I need to do something with this? Also, how do I have one agent run multiple apps?

Thank you for your help David. You have no idea how much this means to us.


ok the log file is getting written now… Both are showing this at the end:


[05/11/2018 10:27:14.105]: Try #30: WAIT [05/11/2018 10:27:15.386]: Exception caught by script [05/11/2018 10:27:15.402]: Login button not found [05/11/2018 10:27:15.402]: At C:\Monitoring\Citrix\Scripts\Test-CitrixApp.ps1:213 char:9 + throw “Login button not found” + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [05/11/2018 10:27:15.418]: Quitting Internet Explorer [05/11/2018 10:27:15.433]: Releasing Internet Explorer COM object [05/11/2018 10:27:15.465]: *************** LAUNCHER SCRIPT END ***************

cool defo getting somewhere

if you use a csv rather than the Json config you can add multiple lines and the discovery will see them all as separate apps (uses the same log in)

we have 2 desktops running 10 test each at 20 min intervals (2 mins per test)

so next to get by the log in screen add the following

    $buttons = $internetexplorer.Document.body.getElementsByClassName('auth-choice-link authentication-link')
    foreach($button in $Buttons){$}

add this in the Try block near the bottom of the test script between

    Open-InternetExplorer -SiteURL $SiteURL



this finds the “switch to username and password” button if it exists and clicks it to move to the form based login page

but it the script is already on the form doesn’t do anything so win/win

i also added it to this function to try each time it fails

function Test-LoginForm {
 Write-ToSFLauncherLog "Detecting NetScaler Gateway or StoreFront login form..."
 $loginButton = $null
 $try = 1
 do {
 $NGloginButton = [System.__ComObject].InvokeMember(“getElementById”,[System.Reflection.BindingFlags]::InvokeMethod, $null, $document, $NGLoginButtonId)
 $SFloginButton = [System.__ComObject].InvokeMember(“getElementById”,[System.Reflection.BindingFlags]::InvokeMethod, $null, $document, $SFLoginButtonId)
 if ($NGloginButton -ne $null -and $NGloginButton.GetType() -ne [DBNull]) {
 New-Variable -Name isNG -Value $true -Scope Script
 $loginButton = $NGloginButton
 } elseif ($SFloginButton -ne $null -and $SFloginButton.GetType() -ne [DBNull]) {
 "Try #$try`: SUCCESS","STOREFRONT DETECTED" | Write-ToSFLauncherLog
 New-Variable -Name isNG -Value $false -Scope Script
 $loginButton = $SFloginButton
 } else {
 Write-ToSFLauncherLog "Try #$try`: WAIT"
<strong> $buttons = $internetexplorer.Document.body.getElementsByClassName('auth-choice-link authentication-link')</strong>
<strong> foreach($button in $Buttons){$}</strong>
 Start-Sleep -Seconds 1
 } until ($try -gt $TimeoutForSFLoginPage)
 if ($loginButton -eq $null -or $loginButton.GetType() -eq [DBNull]) {
 throw "Login button not found"

cool. So does this need to be changed in the xml mp or the Test-MyCitrixApp.ps1 in the Monitoring\Citrix\Scripts folder?

just the PS1 on the server