Install-IisWebsite

Installs a website.

Syntax

Install-IisWebsite [-Name] <String> [-Path] <String> [[-Bindings] <String[]>] [-AppPoolName <String>] [<CommonParameters>]

Description

Installs a website named Name, serving files out of the file system from Path. If no app pool name is given (via the AppPoolName parameter), IIS will pick one for you, usually the DefaultAppPool. If a site with name Name already exists, it is deleted, and a new site is created.

By default, the site listens on all IP addresses on port 80. Set custom bindings with the Bindings argument. Multiple bindings are allowed. Each binding must be in this format (in BNF):

<PROTOCOL> '/' <IP_ADDRESS> ':' <PORT> ':' [ <HOSTNAME> ]

Valid bindings are:

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String The name of the website true false
Path String The path to the website true false
Bindings String[] The site's network bindings. Default is http/*:80:. Bindings should be specified in protocol/IPAddress:Port:Hostname format.
  • Protocol should be http or https.
  • IPAddress can be a literal IP address or *, which means all of the computer's IP addresses. This function does not validate if IPAddress is actually in use on this computer.
  • Leave hostname blank for non-named websites.
false false
AppPoolName String The name of the app pool under which the website runs. The app pool must exist. If not provided, IIS picks one for you. No whammy, no whammy! false false

EXAMPLE 1

Install-IisWebsite -Name 'Peanuts' -Path C:\Peanuts.com

Creates a website named Peanuts serving files out of the C:\Peanuts.com directory. The website listens on all the computer's IP addresses on port 80.

EXAMPLE 2

Install-IisWebsite -Name 'Peanuts' -Path C:\Peanuts.com -Bindings 'http/*:80:peanuts.com:'

Creates a website named Peanuts which uses name-based hosting to respond to all requests to any of the machine's IP addresses for the peanuts.com domain.

EXAMPLE 3

Install-IisWebsite -Name 'Peanuts' -Path C:\Peanuts.com -AppPoolName 'PeanutsAppPool'

Creates a website named Peanuts that runs under the PeanutsAppPool app pool