Resolving URLs

by May 21, 2013

Sometimes you may stumble across URLs like this one:

As it turns out, 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:

$URLRaw = ''
(Invoke-WebRequest -Uri $URLRaw -MaximumRedirection 0 -ErrorAction Ignore).Headers.Location

Twitter This Tip! ReTweet this Tip!