Stop / Start a Site in IIS

Stop / Start a Site in IIS


For the last 20 years, my day job has been developing Web Applications on the Microsoft ASP.Net platform. These applications have always been run on IIS, and stopping and starting them occasionally has sometimes been the only way to fix issues with IIS and Dot Net framework problems.


There are several ways to do this, including using the IIS Management Console. Alternatively, there is a web administration plugin for Powershell. It is installed and used like this: –

Import-Module WebAdministration
$siteName = "Default Web Site"
$serverName = "name"
$block = {Stop-WebSite $args[0]; Start-WebSite $args[0]}; 
$session = New-PSSession -ComputerName $serverName
Invoke-Command -Session $session -ScriptBlock $block -ArgumentList $siteName

To get access to system modules, Powershell needs to be run like this:

[path]\powershell.exe -NoExit -ImportSystemModules


Hi, my name is Stephen Finchett. I have been a software engineer for over 30 years and worked on complex, business critical, multi-user systems for all of my career. For the last 15 years, I have been concentrating on web based solutions using the Microsoft Stack including ASP.Net, C#, TypeScript, SQL Server and running everything at scale within Kubernetes.