Use PowerShell to stop ‘Default Web Site’ in IIS6

Question:

I’ve done several Google searches and can’t find a good sample to stop/start the ‘Default Web Site’ (in II6) using PowerShell.

This…

from here got me started, but I can’t get the ‘start’/’stop’ syntax right.

Answer:

Check the serverState property. A value of 2 means running and a value of 3 means stopped, you can set them this way:

start the website

$site.serverState = 2

$site.setInfo()

stop the website

$site.serverState = 3

$site.setInfo()

Source:

Use PowerShell to stop ‘Default Web Site’ in IIS6 by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply