Running windows command

Hi,
Is there a way to run a DOS command on a windows machine(Say MachineX)
from another remote windows machine(Say MachineY). But only MachineY
has webmethods installed. Using the webmethods on MachineY, I want to
run a command on MachineX which doesn’t have webmethods.

i think the solution should refer to java programming and implement that on webmethods

You can use http://technet.microsoft.com/en-gb/sysinternals/bb897553.aspx which will let you execute a command on a remote host.

If you need to execute this from IS, you need to code a Java service to call PsExec with proper parameters, and psexec will do the rest for you.

Devnull43 thankyou.

Im using the command “psexec \machine1 -w F:\webMethods F:\webMethods\IS2\cmdexe.bat”

where machine1 is remote machine and
F:\webMethods is working directory
and F:\webMethods\IS2\cmdexe.bat is a batch file which has a command.

When im running this command from my local machine im able to run it successfully but when I use webmethods it doesn’t work.

From webmethods im using the service PSUtilites.misc:makeSystemCall and
feeding this sevice with the above command i have mentioned. But the
service runs continuously and doesn’t terminate.

Any suggestions?

You got it running from local machine, so that’s first target… congrats.

Now you need to execute a syscall from IS, and you choose to use PSUtilities package.
I’m not familiar with makeSystemCall service, but probably you need to pass some environment variables needed by psexec. You are almost sire getting an error from the call as psexec cannot find path for needed libraries.

Get some documentation on makeSystemCall service, and you will end up running all.

Good luck!

Hi devnull thanks for the motivation…

I tried implementing it using ‘psexec’ but it did not work out as expected. anyway I found out why my service was not terminating when called from webmethods. That was because when the service calls the command ‘psexec’ the service should in return accept the EULA of the program PSTools, but webmethods doesn’t know how to accept the EULA. So I went thru some microsoft forums and found out a switch to be added to the command to accept the EULA, so now the command becomes…

psexec -accepteula \machine1 -w F:\IntegrationServer F:\IntegrationServer\packages\napster\cmdexe.bat

But somehow even this did not work out as expected. So gave up on this approach.

My second approach was simple and effective. I just mapped the shared drive from remote system to my local machine using the command ‘net use’ from webmethods(which is on local machine). Now I ran the command on the mapped drive to get what I wanted. :cool:

The ‘psexec’ command works like a charm when used from my local machine without involving webmethods!!