Data Infrastructure Management Software Discussions

Highlighted

Making a WFA Command fail, when an error is detected when Command is run within a WFA Workflow

Looking for best/recommended way to get a WFA command to fail, when executed in a workflow, and some part of the PowerShell code within the command errors out. I am using PowerShell in my WFA commands, and I use try/throw/catch setup for issuing commands to a non-netapp storage device, and analyze the return from the storage system, and I have seen times when I get an error, but the WFA command reports back to the calling WFA Workflow, that the command completed succesfully.

 

I am a Powershell novice, so I suspect it's something I'm doing wrong within my PowerShell script.

 

 

Here is an example output from a WFA command when run within a WFA Workflow:

15:18:58.019 INFO [IBM Start or Stop vdisk RC Relationship] ### Command 'IBM Start or Stop vdisk RC Relationship' in 'POWER_SHELL' ###

15:19:14.457 INFO [IBM Start or Stop vdisk RC Relationship] TRY: srcVdiskName was set by a previous Workflow step to: RSTRATTON_0066, so we will use RSTRATTON_0066, instead of user-inputted RSTRATTON_0066

15:19:14.472 INFO [IBM Start or Stop vdisk RC Relationship] TRY: rcSourceStorwizeSystemLongName was set by a previous Workflow step to: rclinvsvc01.corp.rc.test, so we will use that value

15:19:14.863 INFO [IBM Start or Stop vdisk RC Relationship] srcSystemhostkey is now set to: 9e:d5:75:15:74:8b:67:04:85:bf:f5:ec:b2:7d:bb:60

15:19:14.894 ERROR [IBM Start or Stop vdisk RC Relationship] The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

15:19:14.910 INFO [IBM Start or Stop vdisk RC Relationship] TRY: rcTargetStorwizeSystemLongName was set by a previous Workflow step to: rclascsvc01.corp.rc.test, so we will use that value

15:19:14.941 INFO [IBM Start or Stop vdisk RC Relationship] tgtSystemhostkey is now set to: 82:c8:2f:d8:6b:07:5e:37:22:c4:26:95:f4:c8:e2:b1

15:19:17.207 INFO [IBM Start or Stop vdisk RC Relationship] Credentials successfully provided for 'RC_IBM_Storwize'

15:19:17.223 INFO [IBM Start or Stop vdisk RC Relationship] Checking the CURRENT state of the RC relationship...

15:19:17.742 INFO [IBM Start or Stop vdisk RC Relationship] Checking the NEW state of the RC relationship...

15:19:18.476 INFO [IBM Start or Stop vdisk RC Relationship] Command completed, took 20457 milliseconds

 

 

1 REPLY 1
Highlighted

Re: Making a WFA Command fail, when an error is detected when Command is run within a WFA Workflow

 -ErrorAction Stop is used frequently in WFA commands to stop the command execution in case of failure. 

 

for e.g.

# Check if iGroup exists
Get-NaIgroup -Names $IgroupName -ErrorAction Stop

Check out the KB!
Knowledge Base
All Community Forums