Posted in
Hosting & IIS7,
Windows Powershell |
4 Comments | 11,526 views | 11/12/2010 01:25
Detailed script about how to create website in IIS7 with Powershell.
1
2
3
4
5
6
7
| Function Create-WebSite
{
Param ($LogDir, $Description, $Domain)
$Domain = ($Domain.TrimStart("www")).TrimStart(".")
New-Item IIS:\Sites\$Description -Bindings (@{Protocol="http";BindingInformation="*:80:$Domain"},@{Protocol="http";BindingInformation="*:80:www.$Domain"}) -PhysicalPath "$LogDir\http"
} |
Function Create-WebSite
{
Param ($LogDir, $Description, $Domain)
$Domain = ($Domain.TrimStart("www")).TrimStart(".")
New-Item IIS:\Sites\$Description -Bindings (@{Protocol="http";BindingInformation="*:80:$Domain"},@{Protocol="http";BindingInformation="*:80:www.$Domain"}) -PhysicalPath "$LogDir\http"
}
$LogDir is the path of FTP directory and $Description is the name of the website.