Created
November 16, 2016 05:45
-
-
Save chrisbrownie/34df65a7c93ff744b7502ef2df63f32d to your computer and use it in GitHub Desktop.
Evaluates redirects being returned by one or more URLs. Good for troubleshooting load balancers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$urls = @( | |
"http://mysite.com", | |
"https://mysite.com.au/" | |
) | |
$tries = 100 | |
foreach ($url in $urls) { | |
$targets = @() | |
1..$tries | % { | |
$x = Invoke-WebRequest $url -MaximumRedirection 0 -ErrorAction ignore -Verbose:$false | |
#$x.Headers.Location | |
$targets = $targets + $x.Headers.Location | |
} | |
"`nResults for target $url`:" | |
$targets | group | Format-List Name,Count | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment