开发者

How to invoke a Windows Scheduled task or a batch file on a server different to the IIS server

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜