Internet Information Server (IIS) can be managed by IIS management console and also by command line interface (CLI). And, I'm big of CLI and try to achieve tasks from CLI, which I could do from UI. CLI is pretty useful when you want to do automation.
Today, I'll share how to control IIS from CLI:
- Open command prompt and Run as administrator.
- Execute below command:
cd %WINDIR%\system32\inetsrv
- List all sites:
appcmd.exe list site
Output
- Stop site:
appcmd.exe stop site "Default Web Site"
Output
- Start site:
appcmd.exe start site "Default Web Site"
Output
Similarly you can do for AppPools, e.g.
- List all app pools
appcmd.exe list apppool
Output
you can try at your machine.
- Recycle app pool
appcmd recycle apppool /appppool.name:"DefaltAppPool"
Output
you can try at your machine.
Please share your feedback.