[英]Pass a variable to a psexec powershell command in vbscript
我正在尝试将用户输入的计算机名称传递给psexec命令。 我已经尝试了一切。 我知道该命令有效,因为如果通过手动输入计算机名称运行文件成功。 我需要将strComputer变量放入\\ strComputer psexec命令中。 提前致谢。
Set objShell = CreateObject("Wscript.shell")
Dim strComputer
strComputer=InputBox("Run app on remote computer",,"Type name here & click OK")
objShell.run("powershell psexec.exe -i -s \\strComputer \\domain.com\folder\app.exe domain.com")
MsgBox("Scan complete")
为什么不为此使用PowerShell脚本?
Contents of myscript.ps1
------------------------
$computerName = Read-Host "Enter name of remote computer"
psexec \\$computerName -i -s \\domain.com\folder\app.exe domain.com
"Scan complete"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.