Get Webclient With Proxy Authentication
Powershell

If your company is using an Internet proxy, and you'd like to access Internet with a webclient object, make sure it uses the proxy and supplies your default credentials to it. You could write a little helper function to get such a pre-configured webclient:

function Get-Webclient { 
    $wc = New-Object Net.WebClient
    $wc.UseDefaultCredentials = $true
    $wc.Proxy.Credentials = $wc.Credentials
    $wc
}

Next, you could retrieve an RSS feed from the Internet. For example:
$webclient = Get-WebClient
[xml]$powershelltips = $webClient.DownloadString('http://powershell.com/cs/blogs/tips/rss.aspx')
$powershelltips.rss.channel.item | Select-Object title, link

Old Cmd S In Powershell

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License