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
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 创建炫丽美观的Html报表
- 从Powershell ***脚本学到的如何执行后台runspace~
- PowerShell Script Analyzer, Script browser 和 Pester
- PowerShell打开或关闭光驱
- PowerShell移动目录中指定文件的方法(非全部文件)
- Powershell小技巧之创建短网址
- PowerShell实现查询打开某个文件的默认应用程序
- PowerShell设置文件只读、隐藏属性的方法
- Windows Powershell扩展类型系统
- PowerShell脚本源码输出到文件的最佳写法
- Windows Powershell 通过函数扩展别名
- PowerShell脚本实现创建桌面快捷方式的方法
- PowerShell重启服务命令Restart-Service详细介绍
- PowerShell中执行Javascript的方法示例
- 探索PowerShell(十三) WMI对象介绍
- Powershell小技巧之使用Copy-Item添加程序到开机启动
- Windows Powershell创建对象
- Windows Powershell 访问数组
- Powershell小技巧之使用WS-Man来调用PowerShell命令