Skip to main content

Demonstrates how to make a PowerShell web request using a proxy server.

$proxyUri = [System.Uri]"http://my-proxy-server:8080"
$proxy = New-Object System.Net.WebProxy($proxyUri)
$proxy.Credentials = New-Object System.Net.NetworkCredential("username", "password")

[System.Net.WebRequest]::DefaultWebProxy = $proxy
[System.Net.WebRequest]::DefaultWebProxy.BypassProxyOnLocal = $true

Invoke-RestMethod -Uri https://blogs.msdn.microsoft.com/powershell/feed/ | Format-Table -Property Title, pubDate