Skip to content

Instantly share code, notes, and snippets.

@Sambardo
Last active February 28, 2018 19:55
Show Gist options
  • Save Sambardo/747419fd29f80056009e30925917932a to your computer and use it in GitHub Desktop.
Save Sambardo/747419fd29f80056009e30925917932a to your computer and use it in GitHub Desktop.
Function MyFunction
{
[cmdletbinding()]
param()
Write-error "Some custom error message"
Write-host "some host message" -ForegroundColor Green
get-process FAKE
}
write-host "running normally" -ForegroundColor Yellow
MyFunction
write-host "running with -erroraction silentlycontinue" -ForegroundColor Yellow
MyFunction -ErrorAction SilentlyContinue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment