Iis – Recycle remote IIS app pool from the command line

command-line-interfaceiisiis-7powershellwinrm

Is it possible to recycle an IIS7 app pool from the command line, on a different machine?

I've found APPCMD (appcmd recycle apppool my-app-pool), but it only operates on the host it's run on, AFAICT.

I heard a rumor there might be a way to do it with Powershell, but I know nothing about that, and I'm apparently not very good at googling for it.

I'm using Vista / Server 2008, if that matters.

EDIT: I found something called WinRM that somebody claims is able to run APPCMD itself, but I'm not sure exactly how, yet.

Best Answer

Ken, if this is run from CMD you could do it with PSExec. This requires no installation on the server you want to access.

Simply copy the contents of the zip to your System32 file (don't include the ELUA or the DLL file) of the computer you want to remote FROM.
Then enter CMD
type
Psexec \\{Computer Name of ISS7 Server} %systemroot%\System32\inetsrv\appcmd recycle apppool my-app-pool

If you are not on the same domain on an domain admin account you will need to enter credentials for administrative access. For more information simply type psexec in a command line with no arguments.