ray88’s diary

お仕事で困ったとき用の自分用の覚書

Power Shell プロキシ人認証を突破してWEBよりファイルDLする wget

PowerShell 目次 - ray88’s diary
PowerShell WebよりファイルをDLする wget - ray88’s diary
■変数設定

PS C:\> $userName = "A123456"
PS C:\> $passWord = "abc123"
PS C:\> $secPasswd=ConvertTo-SecureString $passWord -AsPlainText -Force
PS C:\> $myCreds=New-Object System.Management.Automation.PSCredential -ArgumentList $userName,$secPasswd
PS C:\> $URL = "https://www.au.com/content/dam/au-com/mobile/area/5g/downtown/pdf/mb_5g_downtown_sapporo.pdf"
PS C:\> $OutputPath = "C:\Users\ユーザ名\デスクトップ\test.pdf"
PS C:\> $proxyServerAddress = "http://strings-owset-la20.ABCcompany.com:8080"

wget

wget -Uri $URL -OutFile $OutputPath -Proxy $proxyServerAddress -proxyCredential $myCreds

■貼り付け用

$userName = ""
$passWord = ""
$secPasswd=ConvertTo-SecureString $passWord -AsPlainText -Force
$myCreds=New-Object System.Management.Automation.PSCredential -ArgumentList $userName,$secPasswd
$URL = ""
$OutputPath = ""
$proxyServerAddress = ""

wget -Uri $URL -OutFile $OutputPath -Proxy $proxyServerAddress -proxyCredential $myCreds

※参考URL:
proxy環境下で、Powershellからwgetする - Qiita
wget で認証付きサイトをダウンロードする - WebOS Goodies