Starting, stopping, and restarting IIS

Since you can run command-line programs in PowerShell, the IISReset command can be used to start, stop, and restart IIS using the /START, /STOP, and /RESTART switches:

Starting, stopping, and restarting IIS

If you want to start or stop a particular website rather than the entire IIS installation, you need to use the Start-WebSite and Stop-WebSite cmdlets. They both have a –Name parameter that allows you to specify which site you want to work with. In the following screenshot, I am stopping and starting a website called Test. Also, I have used the Get-WebSite cmdlet after each step to show that the Test site stopped and started correctly:

Get Getting Started with PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.