Skip to content

Instantly share code, notes, and snippets.

@poshcodebear
Created December 26, 2017 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poshcodebear/32374430ae2459ece96cd8136b26ac0d to your computer and use it in GitHub Desktop.
Save poshcodebear/32374430ae2459ece96cd8136b26ac0d to your computer and use it in GitHub Desktop.
Error Examples
# throws an error:
Get-Content nothing
# Should show the same error message:
$Error[0]
# Shows the target of your command:
$Error[0].TargetObject
# Shows the message itself (the first line in the error on your screen):
$Error[0].Exception.Message
# Shows the exact command you used:
$Error[0].InvocationInfo.Line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment