Windows 10 How to connect powershell or CMD with proxy credentials?

LucasCardim

New Member
Hello everyone! I really need help here. I work at a government company and need to connect with a proxy. On browsers there is no problem, but when i need to install something with npm or choco i cant do it via powershell or cmd as administrator. I have my credentials and the proxy ip and port. But in terminal i cant authenticate and always have an connection error trying to install things via npm or choco. What i have to do to authenticate on the proxy this way?
 
In PowerShell you can add this to your ps profile so it's set everything PowerShell runs.

Code:
[System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy()
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

This should work if it's IWA in use.

If the proxy is in-line then I believe you only need the second line.
 
Back
Top