There's a stackoverlow post here which discusses how best to achieve this in PoSH <6 and 6+ https://stackoverflow.com/questions/18771424/how-to-get-powershell-invoke-restmethod-to-return-body-of-http-500-code-response
There's a stackoverlow post here which discusses how best to achieve this in PoSH <6 and 6+
https://stackoverflow.com/questions/18771424/how-to-get-powershell-invoke-restmethod-to-return-body-of-http-500-code-response