我们有一个名为 hyperion 的远程 Windows 服务器。它有一个批处理文件可以杀死所有任务并将其关闭,例如 abc.exe。我想编写一个脚本,从我的 VM 运行这个 abc.exe。注意:我必须提供用户名和密码才能登录到 hyperion 服务器。
将 PSEXEC/ 帮助。如果是的话,有人可以给我确切的脚本吗?
我们有一个名为 hyperion 的远程 Windows 服务器。它有一个批处理文件可以杀死所有任务并将其关闭,例如 abc.exe。我想编写一个脚本,从我的 VM 运行这个 abc.exe。注意:我必须提供用户名和密码才能登录到 hyperion 服务器。
将 PSEXEC/ 帮助。如果是的话,有人可以给我确切的脚本吗?
您可以使用 PsExec 或 WMI 来执行此操作。这是一个使用 WMI 的 VBScript。
strComputer = "RemoteServ"
Set objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
intReturn = objWMIService.Create("Executable.exe", Null, Null, intProcessID)
if intReturn = 0 then
wscript.echo "Program successfully launched"
else
wscript.echo "There was a problem launching program"
end if
wscript.quit