Powershell determine new URL of a permanently moved (redirected) resource

Viewed 5792

I'm using Powershell Core v6-beta.5 using AppImage on Linux. Is there a way to find out the "new" location of a 301 redirect?

Invoke-WebRequest -Method HEAD http://SomethingThatThrows301.com/ -MaximumRedirection 0 throws an error (Response status code does not indicate success: 301 (Moved Permanently)).

While the error does mention that the move is a 301, I'd still like a proper object telling me that, and the new address.

Is there a way to do so?

2 Answers
Related