Background
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.
How?
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