將密碼加密,並以物件的形式執行,可避免手動輸入憑證至 PSCredentials 對話方塊的需要。
若要將密碼加密,並以物件的形式執行
輸入下列指令,依據指示使用密碼並執行:
read-host -assecurestring | convertfrom-securestring | out-file C:\ securestring.txt <password>
$pass = cat C:\securestring.txt | convertto-securestring
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist <domain\user_name>, $pass
Connect -XO [-Host] <String> $mycred [[-Protocol][<String>]] [[-Port] [<String>]]
結果會與標準連線的結果相同:
連線中...
<IP Address> 已連線!
如需詳細資訊,請參閱 PowerShell 說明文件或搜尋網際網路。
Copyright © 2014 Arcserve.
All rights reserved.
|
|