- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2020-09-15T22:58:21+09:00","default:ryuichi","ryuichi")
#author("2020-09-15T22:59:03+09:00","default:ryuichi","ryuichi")
* Enter-PSSessionのパスワード入力を自動化する [#e854c8b3]
PS> $pass = ConvertTo-SecureString -AsPlainText 'password123' -Force
PS> $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'user123', $pass
PS> Enter-PSSession -ComputerName 10.0.0.10 -Credential $cred
** 参考 [#ud37dd63]
- https://docs.microsoft.com/ja-jp/powershell/scripting/learn/remoting/running-remote-commands?view=powershell-7
- https://stackoverflow.com/questions/34768795/pass-password-into-credential