Internet Information Service (IIS) is the popular web server developed by Microsoft Corporation. It runs on Windows servers and serve websites to users. The PowerShell is the configuration and management application for the Microsoft systems. In this tutorial you will learn how to enable (start) or disable (stop) all sites in single command with PowerShell.
Useful links:
Launch PowerShell
Type PowerShell in application search option. Then right click on PowerShell application and select “Run as administrator”. This will provide you administrative privileges to perform actions.
Start or Stop All Sites in IIS
The WebAdministration module provides the methods to manage IIS on windows system. So first, import WebAdministration module on Powershell, then run the following commands to start or stop all IIS sites.
Stop all sites
Import-Module WebAdministration Get-ChildItem -Path IIS:\Sites | foreach { Stop-WebSite $_.Name; }
Start all sites
Import-Module WebAdministration Get-ChildItem -Path IIS:\Sites | foreach { Start-WebSite $_.Name; }