piątek, 6 kwietnia 2018

Powershell Invoke-WebRequest with webproxy

To use Invoke-WebRequest I can't just specify:
Invoke-WebRequest -Uri "http://some.host.com/some.file.txt" -Proxy "proxy1.in.my.company:80"
because I'll receive error message like:

Invoke-WebRequest : The ServicePointManager does not support proxies with the proxy1.in.my.company scheme

Reason? You must specify explicite the protocol http, so it should looks like:
Invoke-WebRequest -Uri "http://some.host.com/some.file.txt" -Proxy "http://proxy1.in.my.company:80"

Of course - you can specify or you must specify credentials or use just only -ProxyDefaultCredentials to use current logon information.

Brak komentarzy:

Prześlij komentarz