Posted on Monday November 17, 2014

Starting and stopping all IIS sites in Powershell

This is just a boring Powershell 4 snippet for starting and stopping IIS websites:

Import-Module WebAdministration
Get-ChildItem -Path IIS:\Sites | foreach { Stop-WebSite $_.Name; }
Get-ChildItem -Path IIS:\Sites | foreach { Start-WebSite $_.Name; }