#author("2020-05-13T02:01:15+00:00","default:admin","admin")
#author("2020-05-15T03:06:18+00:00","default:admin","admin")
*Proxy対応 [#hebd7013]
-[[認証proxyを用いる環境設定(PowerShell):https://qiita.com/kkdd/items/ac6e65f6e2e8fc32e7ca]]
-[[PowerShellで認証プロキシ越え:https://qiita.com/earthdiver1/items/640cbb0d15d750968429]]

-[[PowerShell で proxy 越え:https://moriya.xrea.jp/tdiary/20190122.html]]
-[[Using PowerShell Behind a Proxy Server:http://woshub.com/using-powershell-behind-a-proxy/]]


-以下でProxy越えができた
 PS > $Creds=Get-Credential
 
 PowerShell credential request
 Enter your credentials.
 User: [ユーザ名]
 Password for user [ユーザ名]: [パスワード]
 
 PS > $Wcl=New-Object System.Net.WebClient
 PS > $Wcl.Proxy.Credentials=$Creds
 PS > Invoke-WebRequest http://wiki.examind.net

**スクリプトで使うには [#m3535f63]
-[[スクリプトでcredentialを使う:https://hacknote.jp/archives/20787/]]

-事前にパスワードファイルを生成
 $tmpCred = Get-Credential 
 $tmpCred.Password | ConvertFrom-SecureString | Set-Content "pwd.dat"

-パスワードファイルを使ってプロキシ設定
 PS > $password = Get-Content "pwd.dat" | ConvertTo-SecureString
 PS > $credential = New-Object System.Management.Automation.PsCredential "[ユーザ名]", $password
 PS > $wc = New-Object System.Net.WebClient
 PS > $wc.Proxy.Credentials = $credential
 
-後はアクセスするだけ
 PS > Invoke-WebRequest http://wiki.examind.net



トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS