您的位置:首页 > 运维架构 > Shell

PowerShell管理IIS

2016-07-27 17:53 381 查看
#导入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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  powershell