#导入IIS管理模块
Import-Module WebAdministration
#新建应用程序池 www.xxx.com
New-Item iis:\AppPools\www.xxx.com
Set-ItemProperty iis:\AppPools\www.xxx.com managedRuntimeVersion v4.0 #更改应用程序池版本为4.0,默认为2.0(Windows Server 2008 R2)
#新建站点 www.xxx.com,主机头为 www.xxx.com,路经为 d:\apidd
New-Item iis:\Sites\www.xxx.com -bindings @{protocol="http";bindingInformation=":80:www.xxx.com"} -physicalPath d:\apidd
#为站点 www.xxx.com 添加主机头 imageapi.dd2.com
New-WebBinding -Name "www.xxx.com" -IPAddress "*" -Port 80 -HostHeader imageapi.dd2.com
#为站点 www.xxx.com 更改应用程序池为 www.xxx.com
Set-ItemProperty IIS:\Sites\www.xxx.com -name applicationPool -value www.xxx.com
#在站点www.xxx.com下新建应用程序cust_account_api ,目录为D:\cust_account_api_new
new-item iis:\sites\www.xxx.com\cust_account_api -type Application -physicalpath D:\cust_account_api_new
Set-ItemProperty IIS:\Sites\www.xxx.com\cust_account_api -name applicationPool -value www.xxx.com
#在站点ServerLog下新建虚拟目录cust_account_api ,目录为D:\cust_account_api_new\log
new-item D:\cust_account_api_new\log -type directory -force
new-item iis:\sites\ServerLog\cust_account_api -type VirtualDirectory -physicalpath D:\cust_account_api_new\log
Import-Module WebAdministration
#新建应用程序池 www.xxx.com
New-Item iis:\AppPools\www.xxx.com
Set-ItemProperty iis:\AppPools\www.xxx.com managedRuntimeVersion v4.0 #更改应用程序池版本为4.0,默认为2.0(Windows Server 2008 R2)
#新建站点 www.xxx.com,主机头为 www.xxx.com,路经为 d:\apidd
New-Item iis:\Sites\www.xxx.com -bindings @{protocol="http";bindingInformation=":80:www.xxx.com"} -physicalPath d:\apidd
#为站点 www.xxx.com 添加主机头 imageapi.dd2.com
New-WebBinding -Name "www.xxx.com" -IPAddress "*" -Port 80 -HostHeader imageapi.dd2.com
#为站点 www.xxx.com 更改应用程序池为 www.xxx.com
Set-ItemProperty IIS:\Sites\www.xxx.com -name applicationPool -value www.xxx.com
#在站点www.xxx.com下新建应用程序cust_account_api ,目录为D:\cust_account_api_new
new-item iis:\sites\www.xxx.com\cust_account_api -type Application -physicalpath D:\cust_account_api_new
Set-ItemProperty IIS:\Sites\www.xxx.com\cust_account_api -name applicationPool -value www.xxx.com
#在站点ServerLog下新建虚拟目录cust_account_api ,目录为D:\cust_account_api_new\log
new-item D:\cust_account_api_new\log -type directory -force
new-item iis:\sites\ServerLog\cust_account_api -type VirtualDirectory -physicalpath D:\cust_account_api_new\log