Product: PowerShell Universal
Version: 5.0.9
I’m working on a CRON schedule for one of my scripts that uses this (overengineered) conditional statement:
[bool](Get-PSUEventHubConnection -TrustCertificate).Where({ $null -eq $_.Disconnected }).Count
Theoretically, I shouldn’t need to explicitly cast it to a boolean nor should I need the -TrustCertificate
flag, but the reason for this is that it was directly copied from tests I was running in my local terminal, which evaluated this correctly:
However, when I trigger the schedule, the condition presumably evaluates to false (or errors out) as the schedule never runs. Removing the condition allows the script to run as expected. Any idea what could be causing this condition to fail?