Skip to content

Instantly share code, notes, and snippets.

@vexx32
Created June 14, 2018 14:37
Show Gist options
  • Save vexx32/52810ecba149dfef0045ac4ffd460af2 to your computer and use it in GitHub Desktop.
Save vexx32/52810ecba149dfef0045ac4ffd460af2 to your computer and use it in GitHub Desktop.
Traverse exception stack for all inner exceptions
$Exception = $_
$ExceptionStack = @{
OuterException = $_
}
$Increment = 0
while ($Exception.InnerException) {
$Increment++
$Exception = $Exception.InnerException
$ExceptionStack["InnerException$Increment"] = $Exception
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment