PoshCode / Pansies

Powershell ANSI Escape Sequences, functions for colored output, etc.
MIT License
148 stars 14 forks source link

Changed -ErrorAction to "Ignore" to not add error to $Error #17

Closed MatejKafka closed 3 years ago

MatejKafka commented 4 years ago

When -ErrorAction is SilentlyContinue, the error is not shown, but is still logged in $Error automatic variable and shown from Get-Error. By changing it to Ignore, the error is not logged.

See following for detailed explanation: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7#erroraction

Ignore value was added in PowerShell 3.0, so it should be safe to use for Pansies.