This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
microsoft:powershell_proxy [2019/02/26 10:18] admin |
microsoft:powershell_proxy [2019/02/26 10:20] (current) admin |
||
---|---|---|---|
Line 53: | Line 53: | ||
{{ :microsoft:powershel_proxy_03.jpg?direct&800 |}} | {{ :microsoft:powershel_proxy_03.jpg?direct&800 |}} | ||
+ | If proxy authentication is necessary, the error like “(407) Proxy Authentication Required” will appear when trying to run PoSh commands. Let’s consider two ways of proxy authentication. | ||
+ | If you are signed in using your domain account and your proxy supports NTLM/AD authentication, you can use the credentials of the current user to authenticate on the proxy server (you won’t have to enter your username/password): | ||
+ | |||
+ | <code winbatch> | ||
+ | $Wcl = new-object System.Net.WebClient | ||
+ | $Wcl.Headers.Add(“user-agent”, “PowerShell Script”) | ||
+ | $Wcl.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials | ||
+ | </code> | ||
+ | |||
+ | If you have to authenticate on the proxy server manually, run the following commands and specify user name and password in the corresponding window. | ||
+ | |||
+ | <code winbatch> | ||
+ | $Wcl=New-Object System.Net.WebClient | ||
+ | $Creds=Get-Credential | ||
+ | $Wcl.Proxy.Credentials=$Creds | ||
+ | </code> | ||
+ | |||
+ | {{ :microsoft:powershel_proxy_04.jpg?direct&800 |}} | ||
+ | |||
+ | Now you can try to access an external website or update the help using Update-Help command. | ||
+ | |||
+ | {{ :microsoft:powershel_proxy_05.jpg?direct&800 |}} | ||
+ | |||
+ | Everything turned out! |