I appreciate the rapid help with my problem. I thought I'd try to contribute a little something... Powershell isn't the best at providing full error details from a web request. Here's some code that goes the extra mile and extracts the error details such as "unsupported for networks bound to a template" (it has been simplified, but the key bits are here): Try
{
$MerakiResponse = Invoke-RestMethod -Method Get -Uri "$($URL)$Query" -Headers $Headers # Submit the query to Meraki and pass back the results.
}
Catch
{
$ErrorCode = $_.Exception.Response.StatusCode.value__ # Get the error code
$ErrorDescription = $_.Exception.Response.StatusDescription # Get the error message
# Process the error stream to extract the error details...
$ErrorStream = $_.Exception.Response.GetResponseStream()
$ErrorReader = New-Object System.IO.StreamReader($ErrorStream)
$ErrorFullDetail = $ErrorReader.ReadToEnd()
$ErrorDetail = $($ErrorFullDetail -split """")[3]
write-host "Error: ($ErrorCode) $ErrorDescription`r`nDetail: `r`n$ErrorDetail"
}
... View more