views:

41

answers:

2

I have a asp.net web site, I would like a page on that site to be able to invoke a Windows Scheduled task or a batch file on a server different to the IIS server?

Is it possible? How should I do this?

A: 

Simplest way would be to place a Web Service on the server that needs to run the scheduled task/batch file (we'll call this SERVER1). That service should have a method that will invoke the scheduled task/batch file (we'll call this method Invoke).

Then from the asp.net web site on the other server (SERVER2), we'll add a link to run our method on SERVER1, http://SERVER1/YourWebService.asmx/Invoke.

To me this would be the easiest way to manipulate SERVER1 from an outside entity (In your case an asp.net web site).

Note: You may run into security issues with your Web Service invoking scheduled tasks and running batch files. I believe it can be done, but you may need to play with your .Net permission settings.

Brandon Boone
thanks +1 if i could.
Rob.Oakshott
Why can't you? Add your restrictions to your question and perhaps we can get around them (as long as it's for a legit purpose and not some shady business). :)
Brandon Boone
A: 

Try PsExec. It's a free tool from Microsoft that will let you execute processes remotely.

Make sure to check out all the other tools in the Sysinternals Suite; there's some really good stuff in there.

whatknott