Skip to content

Instantly share code, notes, and snippets.

@wgross
Last active August 29, 2015 14:05
Show Gist options
  • Save wgross/f726ec5645ec59e476e8 to your computer and use it in GitHub Desktop.
Save wgross/f726ec5645ec59e476e8 to your computer and use it in GitHub Desktop.
<#
.SYNOPSIS
Make a download with webclient using the DefaultNetworkCredentials to authenticate at proxy.
Afterwards all new webclient based cmdlets can pass the proxy.
.DESCRIPTION
Make a download with webclient using the DefaultNetworkCredentials to authenticate at proxy.
Afterwards all new webclient based cmdlets can pass the proxy.
.EXAMPLE
Just call to install credentials
Initialize-WebClientProxyCredentials.ps1
.LINK
http://blog.stangroome.com/2013/08/02/powershell-update-help-and-an-authenticating-proxy/
#>
# make one download through proxy with authentication
$wc = New-Object System.Net.WebClient
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$tmp = $wc.DownloadString('http://microsoft.com')
Write-Host "Default network credentials are installed. You can use other WebClient based clients" -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment