Installs a website.
Install-IisWebsite [-Name] <String> [-Path] <String> [[-Bindings] <String[]>] [-AppPoolName <String>] [<CommonParameters>]
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> ]
PROTOCOL
is one of http
or https
.IP_ADDRESS
is a literal IP address, or *
for all of the computer's IP addresses. This function does not validate if IPADDRESS
is actually in use on the computer.PORT
is the port to listen on.HOSTNAME
is the website's hostname, for name-based hosting. If no hostname is being used, leave off the HOSTNAME
part.Valid bindings are:
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.
|
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 |
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.
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.
Install-IisWebsite -Name 'Peanuts' -Path C:\Peanuts.com -AppPoolName 'PeanutsAppPool'
Creates a website named Peanuts
that runs under the PeanutsAppPool
app pool