首页 文章

将变量传递给vbscript中的psexec powershell命令

提问于
浏览
0

我正在尝试将用户输入计算机名称传递给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")

1 回答

  • 0

    为什么不使用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"
    

相关问题