Home All Groups Group Topic Archive Search About

Execute a batch file on remote host



Author
30 Oct 2007 4:16 PM
Hulicat
Running Windows 2003 R2 I need to execute a batch on remote Windows
2003 R2 machine.

I have tried a number of things including rexec, etc.

The goal would not to deploy any additional code to the remote host.

Is there a way to this via Cscript?do I need to write a vbs script?

Thanks,
Dennis

Author
30 Oct 2007 4:52 PM
Chris M
Hulicat wrote:
> Running Windows 2003 R2 I need to execute a batch on remote Windows
> 2003 R2 machine.
>
> I have tried a number of things including rexec, etc.
>
> The goal would not to deploy any additional code to the remote host.
>
> Is there a way to this via Cscript?do I need to write a vbs script?

Check out PsExec:

http://www.microsoft.com/technet/sysinternals/Security/PsExec.mspx

--
Chris M.
Author
30 Oct 2007 6:04 PM
Richard Mueller [MVP]
Dennis wrote:

> Running Windows 2003 R2 I need to execute a batch on remote Windows
> 2003 R2 machine.
>
> I have tried a number of things including rexec, etc.
>
> The goal would not to deploy any additional code to the remote host.
>
> Is there a way to this via Cscript?do I need to write a vbs script?

A VBScript program can use WMI to connect to the remote computer, copy the
executable (a batch file in this case), run it, wait for execution to
complete, then delete the file. I have an example VBScript program that does
this for all computers in a domain group. You can either modify this for one
computer, or place the computer object in a group by itself. The program
deploys only to computers in the group, so it does not hurt to have user
objects in the group.

http://www.rlmueller.net/Deploy.htm

The program writes a log to document everything.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Author
30 Oct 2007 8:36 PM
urkec
Show quote
"Hulicat" wrote:

> Running Windows 2003 R2 I need to execute a batch on remote Windows
> 2003 R2 machine.
>
> I have tried a number of things including rexec, etc.
>
> The goal would not to deploy any additional code to the remote host.
>
> Is there a way to this via Cscript?do I need to write a vbs script?
>
> Thanks,
> Dennis
>
>

You can try to modify this sample from the Script Center.
http://www.microsoft.com/technet/scriptcenter/scripts/os/process/procthd/pcthvb03.mspx

I think you can't run interactive processes using Win32_Process class on
Windows 2003, but I'm not sure.

--
urkec

AddThis Social Bookmark Button