Skip to content

Instantly share code, notes, and snippets.

@billkindle
Created June 8, 2020 17:29
Show Gist options
  • Save billkindle/6923e7b823c7384aee4555bea5daa024 to your computer and use it in GitHub Desktop.
Save billkindle/6923e7b823c7384aee4555bea5daa024 to your computer and use it in GitHub Desktop.
# Any URL you want to test
$url = 'https://www.google.com'
# This will gather everything but that's OK
$http = (Invoke-WebRequest -Uri $url)
# I'm using the $http object membertype property to get the status code
Write-Output $http.StatusCode
@billkindle
Copy link
Author

The pester test being run from another system invokes this script and reads the output. The test is expecting 200, but this way if any other status code is found, I'll at least see that output in my test results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment