Study an Exception in PowerShell

PowerShell may not return enough information in an exception. You can read the response stream to dig deeper:

$stream = new-object System.IO.StreamReader($Error[0].Exception.InnerException.Response.GetResponseStream())
$results = $stream.ReadToEnd()
$results
$stream.Close()

The results should be more descriptive than the exception.

 

Leave a Reply