Using the default network credentials
(New-Object System.Net.WebClient).Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
Using a different credentials
Using Get-Credential
(New-Object System.Net.WebClient).Proxy.Credentials = Get-Credential
Using NetworkCredential Object
(New-Object System.Net.WebClient).Proxy.Credentials = New-Object System.Net.NetworkCredential(<username>, <password>)
Note: You can add any one of these to your powershell profile to allow it to have network connectivity by default using proxy.
Leave a Reply