如何通过命令行远程重新启动 IIS 上的某个应用程序池?

如何通过命令行远程重新启动 IIS 上的某个应用程序池?

我是该盒子的管理员,我想在无需登录该盒子的情况下停止/启动某个应用程序池。

是否有命令行可以执行此任务?

答案1

如果您在计算机上,则以下命令可执行此操作。现在,这不是远程命令。但是,如果您已向 Web 服务器打开 CIFS,则可以使用 PSEXEC 执行此操作。如果您不能/不想通过 RDP 或 PSEXEC 连接到服务器,您也可以通过 telnet 或 SSH 调用它(如果您已启用/安装了这些协议)。

C:\WINDOWS\system32>iisapp.vbs /?
Description: list IIS application pools and associated worker processes.
             Recycle application pools.

Syntax: IIsApp.vbs [{ /a <app_pool_id> | /p <pid> } [/r] ]

Parameters:

Value              Description
/a <app_pool_id>   Specify an application pool by name. Surround
                   <app_pool_id> with quotes if it contains spaces.
                   If used alone without an accompanying action,
                   IIsApp.vbs will report PIDs of currently running
                   w3wp.exe processes serving pool <app_pool_id>.
/p <pid>           Specify a process by process ID. If used alone
                   without an accompanying action, IIsApp.vbs will
                   report the AppPoolId of the w3wp process specified
                   by <pid>. When a PID is specified with /r, that PID
                   is mapped to an application pool and the action is
                   taken upon the application pool. If a PID is given
                   for a web garden, i.e. an application pool served
                   by more than one w3wp, then all w3wp's for that
                   application pool will be acted upon.
/r                 Recycles the application pool.

DEFAULT: no switches will print out the PID and AppPoolId.

相关内容