Aşağıda, PowerShell cmdlet aracılığıyla IIS’de yeni bir website,app pool oluşturmayı gösteren basit bir kod parçası bulunmaktadır.
$SiteFolderPath="c:\deneme1"
$SiteAppPool="Deneme1"
$SiteName="Deneme1"
$SiteHostname="www.onurcan.com.tr"
New-Item $SiteFolderPath -type Directory
New-Item IIS:\AppPools\$SiteAppPool
Set-ItemProperty IIS:\AppPools\$SiteApppool managedRuntimeVersion v4.0
New-Item IIS:\Sites\$SiteName -physicalPath $SiteFolderPath -bindings
@{protocol="http";bindingInformation=":80:"+$SiteHostName}
Set-ItemProperty IIS:\Sites\$SiteName -name applicationPool -value $SiteAppPool
Powershell ISE ile aşağıdaki script execute edildiğinde website,application pool,directory path,hostname,Application pool versiyonun oluşturulduğunu görmekteyiz.


