0

I have two windows boxes. one is windows xp(local computer) where i need to write a batch file and the other is windows server 2003 where my IIS is located. Now i need to write a batch file in windows Xp that needs to do these below mentioned operations in it.

  1. Stop the IIS or my application pool on that IIS.
  2. Start the IIS or my application pool on that IIS.

    These stop and start need to be performed in two different lines. The windows Server 2003 box has a different user id and password to my windows xp(local computer). As i am new to writing the batch files, after my one day of struggle i am just able to kill the process of my application pool(w3wp.exe) on IIS which is located in the windows server 2003 and i am still not sure what i have written is correct or not. Please help me how to stop and start the IIS which is on server 2003 box, as the batch file should be on the xp box. Thanks in advance for your help.

4

2 回答 2

0

有一个用于启动/停止/重新启动 IIS 的内置程序 - iisreset.exe

单独调用此程序将停止然后重新启动 IIS。如果您只想停止 IIS 而不重新启动它,请使用以下命令:

iisreset.exe /停止

然后你可以像这样再次启动它:

iisreset.exe /开始

这应该适用于所有版本的 IIS,无论操作系统版本如何。请记住,您需要以管理员身份执行它。

编辑:刚刚注意到您想从 XP 框中运行命令以在 W2K3 框上重新启动 IIS - 有一个可选参数来指定目标计算机:

iisreset.exe 服务器名称或Ip /停止

和:

iisreset.exe 服务器名称或Ip /START

于 2012-12-31T02:55:57.853 回答
0

最后经过长时间的努力,我通过“从具有不同 ID 和密码的远程框启动和停止 iis”使其工作。我最初尝试了 runas 命令,但它不起作用,然后我转到 ps 工具并使用下面提到的命令。

psexec \COMPUTER_NAME -u USERID -p PASSWORD iisreset.exe /START ----> 用于启动 iis psexec \COMPUTER_NAME -u USERID -p PASSWORD iisreset.exe /STOP ----> 用于停止 iis

@djhayman --- 感谢您的帮助。

于 2012-12-31T15:51:40.970 回答