Wednesday, June 19, 2013

Resolving URLs


Sometimes you may stumble across URLs like this one:
http://go.microsoft.com/fwlink/?LinkID=135173

These are just "pointers" to the real web address. In PowerShell 3.0, the new cmdlet Invoke-WebRequest can resolve these URLs and return the real address that it points to:

(Invoke-WebRequest -Uri $URLRaw -MaximumRedirection 0 -ErrorActionIgnore).Headers.Location



No comments:

Post a Comment