ErrorAction parameter

suggest change

Possible values are Continue | Ignore | Inquire | SilentlyContinue | Stop | Suspend.

Value of this parameter will determine how the cmdlet will handle non-terminating errors (those generated from Write-Error for example; to learn more about error handling see [topic not yet created]).

Default value (if this parameter is omitted) is Continue.

-ErrorAction Continue

This option will produce an error message and will continue with execution.

PS C:\> Write-Error "test" -ErrorAction Continue ; Write-Host "Second command"

-ErrorAction Ignore

This option will not produce any error message and will continue with execution. Also no errors will be added to $Error automatic variable.

This option was introduced in v3.

PS C:\> Write-Error "test" -ErrorAction Ignore ; Write-Host "Second command"

-ErrorAction Inquire

This option will produce an error message and will prompt user to choose an action to take.

PS C:\> Write-Error "test" -ErrorAction Inquire ; Write-Host "Second command"

-ErrorAction SilentlyContinue

This option will not produce an error message and will continue with execution. All errors will be added to $Error automatic variable.

PS C:\> Write-Error "test" -ErrorAction SilentlyContinue ; Write-Host "Second command"

-ErrorAction Stop

This option will produce an error message and will not continue with execution.

PS C:\> Write-Error "test" -ErrorAction Stop ; Write-Host "Second command"

-ErrorAction Suspend

Available only in PowerShell workflows. If the command hits an error, the workflow is suspended so you can investigate and then resume it. To learn more about workflows, see [topic not yet created].

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents