tags:

views:

1327

answers:

1

In C#, I might do something like this:

System.Net.WebClient w = new System.Net.WebClient();
w.Credentials = new System.Net.NetworkCredential(username, auth, domain);
string webpage = w.DownloadString(url);

Is there a Powershell version of this, or should I just call through to the CLR?

+3  A: 

The PowerShell is almost exactly the same.

$webclient = new-object System.Net.WebClient
$webclient.Credentials = new-object System.Net.NetworkCredential($username, $path, $domain)
$webpage = $webclient.DownloadString($url)
Steven Murawski