Hello,

Yesterday I updated our PRTG server from 20.3.61.1649 to 21.3.69.1333. After that our EXE/script sensors that check Registration state and Amount of sessions of Citrix servers did not work anymore. I did not create the script, but is has been running without problems for at least six years.

The response I get:

Response not well-formed: "(The method or operation is not implemented. A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows. )" (code: PE132)

I don't really have powershell knowledge, but the code is or was correct since it ran for 6 years without errors. As the PRTG upgrade to the new version is the cause of the issue, I would appreciate some help here. I could not find any powershell related changes in the PRTG release notes between the old and new version. So please find one of the two scripts below, hostnames a.s.o. have been anonymized with <string>.

Set-ExecutionPolicy Unrestricted -force

# Get credentials for remote session
$username = "<domain\user>"
$secureString = Get-Content -Path C:\Scripts\PSRemotingCredentials\storedPassword.txt | ConvertTo-SecureString
$password = $secureString = Get-Content -Path C:\Scripts\PSRemotingCredentials\storedPassword.txt | ConvertTo-SecureString
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password

# Open PS Remoting session on DDC (Citrix Desktop Delivery Controller)
$s = new-pssession -computername <DDC host name> -Credential $cred

# Load Citrix snap-in
invoke-command -session $s {Add-PSSnapin -Name Citrix.*}

# Query amount of sessions on CTX server
$SessionCnt = invoke-command -session $s {(Get-BrokerMachine -MachineName  <domain\citrixserver>).SessionCount}

Exit-PSSession

if ($SessionCnt -gt 20) {
  $x=[string]$SessionCnt+":Down"
  write-host $x

  exit 2
}

ElseIf ($SessionCnt -gt 15) {
  $x=[string]$SessionCnt+":Warning"
  write-host $x

  exit 1
}

Else
{
  $x=[string]$SessionCnt+":OK"
  write-host $x

  exit 0
}

Article Comments

After this update we've seen the same behavior in some powershell scripts as well. We've found no solution yet.


Aug, 2021 - Permalink

Hi there,

Does the issue also occurs when you are using write-output instead of write-host? Please exchange this in your script and check if the issue occurs again.


Kind regards

Felix Wiesneth - Team Tech Support


Aug, 2021 - Permalink

Hi Felix,

We received the suggestion of your colleague to switch off the experimental feature "PowerShell Security Enhancement" and that did the trick for this sensor.

Will try your suggestion as well and will post my findings here.

R


Aug, 2021 - Permalink

Hi Felix,

Your "write-output" works smoothly together with the new feature "PowerShell Security Enhancement".

Thanks for your help!

Rgds, Remco


Aug, 2021 - Permalink

Hello, Sorry for late reply, after a week I forgot about the topic.

Repalcing write-host with write-output did the trick, the above script works again. Thanks.


Aug, 2021 - Permalink

Hi Han,

Glad to hear that it is working now.


Kind regards

Felix Wiesneth - Team Tech Support


Aug, 2021 - Permalink