How to stop a web site using vb-script
(Kristofer Gafvert, July 17, 2010)Introduction
This example shows you how to stop a web site running on IIS 7, by using vb-script (visual basic). Remember that you need to run the script as a user with permissions to stop the web site, and you also need to have "IIS Management and script Tools" installed, otherwise you will get a 8004100E error message.
' Connect to the WMI WebAdministration namespace.
Set oIIS = GetObject("winmgmts:root\WebAdministration")
' Specify the Web site name.
Set oSite = oIIS.Get("Site.Name='Test'")
' Stop the Web site.
oSite.Stop
Applies to [?]
IIS 7.0, IIS 7.5
Resources