Skip to content

Instantly share code, notes, and snippets.

@bhrgu
Last active November 1, 2017 05:58
Show Gist options
  • Save bhrgu/49be4e703c256cc584d04e8ecf764289 to your computer and use it in GitHub Desktop.
Save bhrgu/49be4e703c256cc584d04e8ecf764289 to your computer and use it in GitHub Desktop.
Basic HTTP auth with Powershell example
$username='admin'
$password='s3cr3t'
$WebResponce = Invoke-WebRequest -Uri "http://192.168.1.1/" `
-Headers @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($username+":"+$password))} `
-OutFile .\pstest.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment