如何通过PowerShell在azure VM上安装ARR?

时间:2013-05-03 09:58:08

标签: iis powershell azure

我已将我的项目部署到Azure Cloud Service,但另外我必须安装应用程序请求路由(ARR)。

和平的.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:\ Users \ BUTTER~1 \ AppData \ Local \ Temp \ 2 \ arr.msi 下载... 完成。执行安装...... 停止IIS和WAS ... 1619 完成 VERBOSE:在Target“万维网发布服务(w3svc)”上执行“Start-Service”操作。 VERBOSE:在Target“Windows Process Activation Service(was)”上执行“Start-Service”操作。

没有错误但它没有安装ARR。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:5)

我无法通过PowerShell直接找到这样做的好方法。如果您不介意使用Chocolatey,可以从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

Chocolately的灵感来自这篇博文:http://www.tugberkugurlu.com/archive/script-out-everything-initialize-your-windows-azure-vm-for-your-web-server-with-iis-web-deploy-and-other-stuff