To implement it yourself in PowerShell 1 or 2, you can use the following:
## Declare a function that takes source and destination arguments
Function Get-Webclient ($url, $out) {
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$request = New-Object System.Net.WebCLient
$request.UseDefaultCredentials = $true ## Proxy credentials only
$request.Proxy.Credentials = $request.Credentials
$request.DownloadFile($url, $out)
}
## Call the function with our source and destination.
Get-Webclient "http://www.google.com" "C:\Foo3.txt"
Credit to this post.
No comments:
Post a Comment