http download example.
$req = Invoke-WebRequest 'https://www.test.com/login.php' -SessionVariable sv
$form = $req.Forms[0]
$form.Fields["email"] = 'user@example.com'
$form.Fields["pass"] = 'password'
Invoke-WebRequest -Uri ("https://www.test.com" + $form.Action) -WebSession $sv -Method POST -Body $form.Fields
$cli = New-Object System.Net.WebClient
$url = "http://www.google.com/"
$uri = New-Object System.Uri($url)
# $file = Split-Path $uri.AbsolutePath -Leaf
$cli.DownloadFile($uri, "abc.txt")
# $file + " is downloaded."
powershell -Command "Invoke-WebRequest http://www.foo.com/outfile.dat -OutFile outfile.dat"