Create a New IIS Website with PowerShell

On a Windows Server 2008 R2 machine, IIS has already been installed and you want to create an additional website. If necessary, an additional IP Address has been added to the server also.

Use the New-Website PowerShell cmdlet to accomplish this task:

1Import-Module WebAdministration
2New-Item -type directory -path d:\iis\mikefrobbins
3New-Website -Name "mikefrobbins" -Port 80 -IPAddress "192.168.1.222" -PhysicalPath d:\iis\mikefrobbins -ApplicationPool "ASP.NET v4.0"

ps-create-website1.png

You can get a list of websites running on the server by using the Get-Website cmdlet or by running Get-ChildItem on the IIS PSDrive:

ps-create-website2.png

µ