我想創建一個可以創建本地用戶的Powershell Gui腳本。這裏的問題是,爲什麼代碼要求參數?使用-nopassword它的作品。Powershell添加本地用戶
代碼:
$button_BenutzerErstellen_OnClick=
{
$textBox6.Text
$textBox7 = ConvertTo-SecureString -AsPlainText -Force
if (($handler_textBox6.Text -eq 0) -or
($handler_textBox7.TextLength -eq 0)) {
[System.Windows.Forms.MessageBox]::Show("Bitte füllen Sie alle Kriterien aus." , "Combat 19")
}else{
New-LocalUser $textBox6.Text -Password $textBox7 -Description $textBox1.Text
}
謝謝,但爲什麼代碼問我一個字符串? -nopassword工作,但與密碼它問我的字符串。 –