Capturing Proxy Errors for Powershell connector


I'm fairly new to this so I'm hoping I'm just missing something simple here. What are the best practices for working with Powershell connector errors that come from "Proxy Error: System.Management.Automation.RemoteException". Normally with try/catch I've been referencing the '$_' object or something more specific under Exception and mapping that to a Write-Output variable used later in the flow. However when working with commands that create another session such as Connect-ExchangeOnline this works differently. 

How does one go about outputting the error that comes back in Test Results as a Proxy Error within a flow?


Tags PowerShell iPaaS exchange
Asked by William Fricke on Tue 9/20/22 12:04 PM
Note: Setting -ErrorAction or $ErrorActionPreference to stop will and return the error through the proxy as it would without but I am still curious if there is a way to reference step error messages within a flow.

There appears to be a way through Event Notifications to monitor flow events and get the error messages but is that possible through the flow itself?
- William Fricke Tue 9/20/22 2:55 PM
Sign In to leave feedback or contribute an answer

Answer (1)

This answer has been marked as the accepted answer
Mark Sayers Thu 10/6/22 10:59 AM

Hi William,


There might be an answer for your problem: getting access to errors in remote PS (Exchange). It's described best in this link. The answer might be to wrap the call using Invoke-Command and passing parameters using -ArgumentList.   This should allow you to try/catch the errors produced.  I haven't tested this, but as an example you could try:


try {​ 
-Session $ses
-ScriptBlock {​ Get-Mailbox $args[0] }​
-ArgumentList $UserUPN
-ErrorAction Stop
Write-Output $true
Write-Output ("Success")
catch {​
Write-Output $false
Write-Host ("Error occurred")


No feedback