Friday, July 30, 2010

How to connect to Internet and dowload a page with Powershell

This can't be any easier!

$url="http://www.cnn.com"

$wc= new-object System.Net.WebClient

$proxy = new-object System.Net.WebProxy "http://proxy.company.com:80"

$proxy.Credentials = New-Object System.Net.NetworkCredential ("proxyusername", "proxypassword")

#$proxy.UseDefaultCredentials = $true

$wc.proxy=$proxy

$wc.DownloadString($url)

$oIE=new-object -com internetexplorer.application

$oIE.navigate2($url)

$oIE.visible=$true

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...