you should use WebRequest
$web = Get-SPWeb $webUrl
$path = "C:\file.aspx"
$request = [System.Net.WebRequest]::Create($url)
$request.UseDefaultCredentials = $true
#do web request - if exception -> item does not exist
try {
$response = [System.Net.WebResponse]$request.GetResponse();
if ($response.StatusCode -ne "OK") {
write-host "Error: " $response.StatusCode;
return;
}
# get contents
$stream = [System.IO.Stream]$response.GetResponseStream();
$streamReader = New-Object System.IO.StreamReader($stream);
$data = $streamReader.ReadToEnd();
$enc = [system.Text.Encoding]::UTF8
$filebytes = $enc.GetBytes($data)
$stream.Close();
$streamReader.Close();
# save file
[System.IO.File]::WriteAllBytes($Path, $filebytes)
}
catch [Exception]
{
write-host "exception" $error[0]
}
$web.Dispose()
EDIT:
I was in good mood so I've completed also the code to download contents and save them to file system.