Windows powershell を使用して、Apache Web サーバーを使用して Linux サーバーから Windows 2012 R2 にファイルをダウンロードしようとしています。
注:: URL は HTTPS です
$source = "https://uri"
$destination = "C:\path\file.txt"
$username = "admin"
$password = "@dfkl!f" | ConvertTo-SecureString -asPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($username,$password)
Invoke-WebRequest $source -OutFile $destination -Credential $cred
エラー
Invoke-WebRequest : Authorization Required
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong
credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Apache/2.2.15 (CentOS) Server at url Port 443
ブラウザーで資格情報を入力するとダウンロードできますが、powershell では不正な資格情報が表示されます