Link to home
Start Free TrialLog in
Avatar of jessieBoo
jessieBoo

asked on

Execute batch script from another server

Server A has batch script on it that I would like to execute from Server B. What is the best way to do this? In c#
Avatar of dennisbbb
dennisbbb

I would use a tool called PSEXEC http://technet.microsoft.com/en-us/sysinternals/bb897553
From ServerB prompt, type psecec \\ServerA -U administrator -P pass -c -f -h c:\myscript.anything
Avatar of Todd Gerbert
I understand that you have a batch file that lives on Server A, I'm a little unclear on where you want it to execute - Server A or Server B?
Avatar of jessieBoo

ASKER

I want to execute the batch script on Server A from Server B.

PSEXEC will not work for me because it will always return error code 1.  Internet searches show I’m not the only one having this problem.
Build Webservice on Server A and call It from Server B
Can I use a powershell script?
have the batch script or vbscript on server A check a database every so often..user task scheduler to manage...

On server b if you want to launch write a value to that db with a value "launch"..next time the batch checks that table in five miuntes..it will see value and run...
Can anyone tell me how to code this in powershell using the invoke command?
you post  your question in C# theme.
Yes, but I'm doing my own research and it looks like powershell may be an easy solution. I'm not looing for somethin I can find myself on google.
ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks! your suggestion will work as well.