Powershell脚本部署打好的Website zip包并重启IIS
2012-10-19 10:32
211 查看
直接上Power脚本:
#Get current path $CurrentDir = $( pwd ); #Get MSDeploy path Write-Host "Getting MsDeploy path..."; [int]$MaxMsDeployVersion = 0; $MsDeployVersions = $(Get-Item "HKLM:SOFTWARE\Microsoft\IIS Extensions\MSDeploy\*"); [int]$MaxMsDeployVersion = 0; foreach ($Ver in $MsDeployVersions) { $LastSlash = $Ver.Name.LastIndexOf( "\" ); [int]$ThisNumber = $Ver.Name.Substring( $LastSlash + 1 ); # For debug only: # Write-Log "Last slash position = [$LastSlash]; this version # = [$ThisNumber]"; if ( $ThisNumber -ge $MaxMsDeployVersion ) { $MaxMsDeployVersion = $ThisNumber; } } $MsDeployPath = $( Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\$MaxMsDeployVersion" ).InstallPath; #Go to the path where the MSDeploy at. Set-Location $MsDeployPath ; #Get the parameters file for the web site. [string]$WebSvcParamsFile = "$CurrentDir\WebSite\Parameters.xml" Write-Host "Deploying the Web site..."; [string]$Result = $(.\MsDeploy.exe -verb:Sync -source:package="$CurrentDir\WebSite\Web.zip" -dest:auto -setParamFile:"$WebSvcParamsFile" -enableLink:AppPoolExtension -verbose -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension); Write-Host "MsDeploy completed; output follows:"; Write-Host $Result; Write-Host "Successful completion!"; #======================================= # Reset IIS on the server #======================================= Write-Host "Restarting IIS Services..."; iisreset /noforce;
相关文章推荐
- 利用PowerShell脚本部署IIS站点
- [置顶] IIs Web 站点安全 监控 站点自动部署 重启
- linux 持续构建(自动部署) 重启动tomcat或进程的脚本
- IIs Web 站点安全 监控 站点自动部署 重启
- IIS监控--自动重启脚本工具
- 用powershell脚本实现web站点自动部署
- [6月14日的脚本] 在部署时自动将计算机添加到AD 组中 (PowerShell)
- 自动重启IIS和Tomcat的bat脚本
- 利用PowerShell脚本获取IIS绑定的网站地址和状态
- 重启IIS某个站点脚本
- 用于部署war并重启Tomcat的脚本
- Powershell脚本检测Azure账号是否登陆,资源组是否创建,并部署ARM template
- 重启IIS及StateServer脚本
- PowerShell自动部署网站—(1)、安装IIS[添加角色和角色服务]
- SharePoint自定义程序页面部署 不用重启IIS
- PowerShell自动部署ASP.NET Core程序到 IIS
- 用于部署war并重启Tomcat的脚本
- IIS监控--自动重启脚本工具
- SharePoint自定义程序页面部署 不用重启IIS
- 自动下载源码_并编译_打包_部署_重启服务的Shell脚本