VBScript和PSEXEC - 远程执行应用程序 [英] VBScript and PSEXEC - Remotely Executing Application

查看:256
本文介绍了VBScript和PSEXEC - 远程执行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要更新现有的HTA应用程式。该页面显示公司中最近3天内未执行备份(通过ibm tsm)的每台计算机的记录。我为每个记录创建了一个按钮,当按下时,应该执行一个cscript进程使用PSEXEC在目标机器上运行一个exe,并传递一个参数。 (dsmc.exe INCREMENTAL)现在我可以手动打开一个cmd提示,使用\Remote cmd命令创建一个远程cmd,并运行应用程序很好。但没有创建远程cmd提示的额外步骤,并尝试

  PSEXEC \\RemoteMachine cscript.exeC :\Program Files\tivoli\tsm\baclient\dsmc.exeINCREMENTAL 

只导致错误。我知道应该可以远程执行这个程序,仍然传递一个参数,但它只是不运行。当我创建远程cmd提示使用

  PSEXEC \\RemoteMachine cmd 



执行脚本中的任何其他行都不会执行,直到我退出远程cmd提示符。



有没有一个秘密PSEXEC我不明白或一种方法来抓取现有的cmd提示(我刚刚创建的远程)并传递命令执行?请帮助



*请注意,这不是我使用PSEXEC的第一个脚本。我通常使用我的VBScript在本地创建一个包含PSEXEC脚本的批处理文件,然后执行它。从来没有能够让wsshell.run使用PSEXEC。

解决方案

这里是(或多或少)我的语法使用 objShell.Run 使用 psexec



code> Set objShell = CreateObject(Wscript.Shell)

objShell.Runcmd.exe / c%pathToPsexec% \psexec.exe-accepteula -s -i -d \\RemoteMachine cmd.exe / k ipconfig,0,True



这只是一个例子,但显示您可以发送嵌套开关等。了解psexec的开关也很重要。



-accepteula - 接受psexec的许可协议。这不是必要的,除非你第一次运行它,并且你想要它是安静的。

-s - 作为系统运行帐户的远程计算机。如果你不使用这个,你需要指定 -u -p 如果你想交互运行。否则,您的凭据将执行网络登录

-i - 指定以交互方式运行。这可以省略或指定会话。

-d - 在等待远程命令完成后再继续


I am updating an existing HTA application. The page displays records of each machine in the company that hasn't performed a backup (Via ibm tsm) within the last 3 days. I have made a button for each record that when pressed, should execute a cscript process using PSEXEC that run an exe on the target machine and passes an argument. (dsmc.exe INCREMENTAL) Now i can manually open a cmd prompt, use the \Remote cmd command to create a remote cmd, and run the application just fine. But without the extra step of creating a remote cmd prompt, and trying to

PSEXEC \\RemoteMachine cscript.exe "C:\Program Files\tivoli\tsm\baclient\dsmc.exe" INCREMENTAL

Only results in an error. I know that it should be possible to remotely execute this program and still pass in an argument but it just doesn't run. And when i create the remote cmd prompt using

PSEXEC \\RemoteMachine cmd

Any other lines in the execution script do not execute until i exit the remote cmd prompt.

Is there a secret to PSEXEC i don't understand or a way to grab an existing cmd prompt (The remote one i just created) and pass it the command to execute? Please Help

*Note, this is not my first script using PSEXEC. I typically use my VBScript to create a batch file locally with the PSEXEC Script contained, and then execute it. Never have been able to get wsshell.run to work with PSEXEC.

解决方案

Here is (more or less) my syntax for using objShell.Run to work with psexec:

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "cmd.exe /c ""%pathToPsexec%\psexec.exe"" -accepteula -s -i -d \\RemoteMachine cmd.exe /k ipconfig",0,True

This is just an example, but shows that you can send nested switches, etc. It's also important to understand the switches of psexec.

-accepteula - this accepts the license agreement on psexec. this isn't necessary unless you're running it for the first time and you want it to be quiet.
-s - runs as the System account of the remote computer. If you don't use this, you need to specify -u and -p if you want to run interactively. Otherwise your credentials perform a network logon
-i - specifies to run interactively. This can be omitted or a session can be specified.
-d - don't wait for the remote command to finish before moving on

这篇关于VBScript和PSEXEC - 远程执行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆