2013-05-03 189 views
0

我已将我的项目部署到Azure Cloud Service,但另外我必须安装应用程序请求路由(ARR)。如何通过PowerShell将ARR安装在Azure虚拟机上?

的.ps1 PowerShell命令的和平:

if(Get-Service was) { 
     Write-Host "Stopping IIS and WAS..." 
     Stop-Service was -Force 
    } 


    $filepath="%temp%\arr.msi" 
    $process = (Start-Process -FilePath msiexec -ArgumentList /i, $filepath, /qn -Wait).ExitCode 

    Write-Host $process 
    if(Get-Service was) { 
     Start-Service was,w3svc -Verbose 
    } 

输出:

下载MSI包...... 下载MSI软件包:d:\用户\ BUTTER〜1个\应用程序数据\本地的\ Temp \ 2 \ arr.msi 已下载... 完成。执行安装... 停止IIS和WAS ... 完成 VERBOSE:在目标“万维网发布服务(w3svc)”上执行操作“启动服务”。 VERBOSE:在目标“Windows进程激活服务(已)”上执行“启动 - 服务”操作。

没有错误,但没有安装ARR。谁能帮忙?

+0

使用Powershell的任何特定原因? [这个博客例如](http://robindotnet.wordpress.com/tag/azure-arr/)似乎有另一种方式来做到这一点。 – 2013-05-03 10:02:38

回答

5

我找不到直接通过PowerShell执行此操作的好方法。如果你不介意使用的巧克力,你可以做到这一切从Web平台安装程序的命令行(WebPICMD),例如:

#Download and install Chocolatey and through Chocolatey install WebPICMD 
iex ((new-object net.webclient).DownloadString("https://chocolatey.org/install.ps1")) 
cinst webpicommandline 

#Install Url Rewrite and ARR 
$webPiProducts = @('UrlRewrite2', 'ARRv3_0') 
WebPICMD /Install /Products:"$($webPiProducts -join ',')" /AcceptEULA 

约WebPICMD这里更多信息:http://www.iis.net/learn/install/web-platform-installer/web-platform-installer-v4-command-line-webpicmdexe-rtw-release

灵感的巧克力从这次来到博客文章:http://www.tugberkugurlu.com/archive/script-out-everything-initialize-your-windows-azure-vm-for-your-web-server-with-iis-web-deploy-and-other-stuff

+0

如果安装巧克力,也可以使用'choco install webpicmd'。 – NikG 2015-12-23 17:02:00

+0

'cinst'是'choco install'的别名 – pizycki 2017-01-26 12:42:40