Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to be able to create a new website with a new host header (which I can obviously do using the IIS Manager) from the command line so that it can be scripted.

Essentially what you can do with iisweb on IIS 6.

share|improve this question
up vote 4 down vote accepted

Use built-in appcmd, like this - using the bindings argument a host header can be specified:

appcmd add site /name:contoso /id:2 /physicalPath:c:\contoso /bindings:http/*:80:

The variable name string is the name, and the variable id uint is the unsigned integer that you want to assign to the site. The variables name string and id uint are the only variables that are required when you add a site in Appcmd.exe. The variable bindings string contains information that is used to access the site, and it should be in the form of protocol/IP_address:port:host_header.

share|improve this answer
One thing I found handy was adding multiple bindings in a single call. To do so, wrap each binding in quotes and comma-separate them: appcmd add site /name:contoso /bindings:"http/*:80:","https/*:443:" /physicalPath:C:\contoso. Otherwise, you have to do a separate call for each: appcmd set site /"G4" /+bindings.[protocol='https',bindingInformation='*:443:']. – patridge Jul 14 '10 at 16:32


Import-Module WebAdministration 
New-Website -name "[name]" -HostHeader "[]" -PhysicalPath "[c:\inetpub\\]"

Using Powershell combined with the .NET assembles:


You can basically control every facet of the web site/web server.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.