O'Reilly logo

Windows PowerShell™ Scripting Guide by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Starting and Stopping Web Sites

There are times when a Web site must be either stopped or started. You might stop a Web site for maintenance or for security reasons. It is obvious why a Web site needs to be started: A Web site that is not running is useless as a Web site! To stop or start a Web site, use the WMI classes supplied by the IIS 7 WMI provider.

The StartStopSite.ps1 script is an example of a script that can be used to start and stop Web sites. It begins with the param statement and defines a number of parameters. The -site parameter names the Web site to be either stopped or started. The other parameters are optional. The -start parameter is a switched parameter and, if present, causes the script to start the Web site. The -stop parameter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required