Hi there, lately, I’ve been confronted with a problem where I simply couldn’t get meaningful error messages from failing runs of Invoke-Webrequest. In doing something like this:
log "Creating new session token for $Url"
$result = Invoke-WebRequest -uri $Url -Headers $headers -Method GET
$err = $_.Exception.Message
$err would only ever contain the error code like “500 bla”, but not what the server actually returned as the error message. I was querying a REST […]