powershell可以通过弹窗录入数据作为参数执行脚本吗?


PowerShell交流中心powershell可以通过弹窗录入数据作为参数执行脚本吗?
0
yantou0001 asked 6 年 ago

期望的效果是通过PS脚本让用户自己加域,且只需要输入计算机名

因为不想让用户自己改PS,所以希望用户执行PS后通过弹窗提示录入,录入的信息作为加域机算机名参数执行加域的脚本

1 Answers
-1
Best Answer
Mooser Lee 管理员 answered 6 年 ago
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
$computer = [Microsoft.VisualBasic.Interaction]::InputBox("Enter a computer name", "Computer", "$env:computername")