Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

June 26, 2008 12:00 AM

Configuring IIS 7.0 from the Command Line

Windows IT Pro
InstantDoc ID #98838
Rating: (0)

Q: Is there an easy way to configure Microsoft IIS 7.0 Web server (i.e., the Web server that runs on Windows Server 2008 and Windows Vista) authentication settings from the command line? For example, I would like to enable/disable anonymous access to my Web server from the command line.

 

A: In IIS 7.0, you can leverage the Appcmd.exe command-line utility to configure Web server authentication settings from the command line. For example, to disable anonymous access at the IIS root level from the command line, you would use the following Appcmd command:

 

appcmd set config -section:anonymousAuthentication -enabled:false

 

To do the same for your IIS server’s default Web site, use the command

 

appcmd set config "Default Web Site/" -section:anonymousAuthentication -enabled:false

 

The anonymousAuthentication parameter in the previous commands corresponds to an IIS configuration setting (hence the use of the config parameter in the previous commands) that's stored in one of the IIS 7.0 XML-formatted configuration files. (Note that these files replace the IIS metabase, which is the configuration database that's used in earlier IIS versions.) The IIS 7.0 configuration files are called applicationHost.config, which is the global IIS Web server configuration file, and web.config at the different application/Web site levels in the IIS 7.0 application/Web site hierarchy. A good overview of the IIS 7.0 configuration files is available at http://mvolo.com/blogs/serverside/archive/2007/07/21/Anatomy-of-an-IIS7-configuration-path.aspx.

     

The Appcmd.exe tool is located in the %systemroot%\system32\inetsrv\ directory. Because this file system location isn't automatically part of a Server 2008 or Vista system’s PATH environment variable, you must use the full path to Appcmd.exe when executing Appcmd commands. You can also manually add the inetsrv directory to your machine’s PATH environment variable so that you can access AppCmd.exe from any file system location. A good introduction to the Appcmd.exe command-line utility is available at http://www.iis.net/articles/view.aspx/IIS7/Use-IIS7-Administration-Tools/Using-the-Command-Line/Getting-Started-with-AppCmd-exe and http://go.microsoft.com/fwlink/?LinkId=60957.

 

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.