Created
December 20, 2016 06:21
-
-
Save zhangyuan/acf0a62ad466e084067d07d9f518ea3b to your computer and use it in GitHub Desktop.
Send HTTP Request with Credential (HTTP Basic Authentication)
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
| $username = "" | |
| $password = "" | |
| $url = "" | |
| $securePassword = ConvertTo-SecureString $password -AsPlainText -Force | |
| $credential = New-Object System.Management.Automation.PSCredential ($username, $securePassword) | |
| $stream = Invoke-WebRequest -Uri url -Credential $credential | |
| Write-Host $stream.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment