Will capture the command output, as text, in $x. You would then need to parse it once the command completes. However, if the command never completes… I’m not sure what you’d do.
AnyConnect has its own Eventlog.
Get-WinEvent -Logname ‘Cisco AnyConnect Secure Mobility Client’
Maybe you can use an event in it to trigger some action when that Login error occurs.