Created
November 1, 2016 15:02
-
-
Save ctigeek/5413faf40f11e8b9aeee6f3d6725650d to your computer and use it in GitHub Desktop.
GET the response code from a URL.
This file contains 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
function Get-ResponseCode($url) { | |
try { | |
$response = Invoke-WebRequest $url | |
$response.StatusCode | |
} | |
catch { | |
$_.Exception.Response.StatusCode.Value__ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment