Skip to content

PowerShell Connector Failed Operations

If an operation against the target system fails, the PowerShell script must handle this correctly so that UNIFYConnect can correctly generate accurate logging and reporting.

Complete Failures

If an operation being handled by a PowerShell script fails completely, the exception can either be left to be handled by UNIFYConnect, which will report the error back; alternatively it can be retried in the PowerShell script.

Single Operation Failures

Where many singular operations are being applied to one or more entities, such as Adds, Deletes or Updates, failure can be reported on a per-entity basis.

UNIFYConnect makes available Failures, an empty collection which should be populated with entities that do not successfully complete the operation against the target system:

PowerShell
foreach ($entity in $components.InputEntities) {
  # Perform an operation
  $boolIsSuccessful = ... 
  
  if ($boolIsSuccessful -eq $false) {
    $components.Failures.Push($entity)
  }
}