install.ps1
param( [parameter(Mandatory=$true)] [String]$url ) $client = New-Object System.Net.WebClient $uri = New-Object System.Uri($url) $file = Split-Path $uri.AbsolutePath -Leaf $downloadPath = Join-Path $Env:TEMP $file Write-Host "$uri を Download します" $client.DownloadFile($uri, $downloadPath) $installLogPath = Join-Path $Env:TEMP ($file + ".log") Write-Host "$file を Install します" msiexec /i $downloadPath /quiet /l* $installLogPath while ($true) { sleep -m 500 try { $fs = [System.IO.File]::Open($installLogPath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite) $fs.close() break } catch [Exception]{ Write-Host "lock" } } $log = Get-Content $installLogPath Write-Host $log Write-Host "$downloadPath を 削除 します" Remove-Item $downloadPath Remove-Item $installLogPath
MSDN System.Net.WebClient と TechNet Msiexec (コマンド ライン オプション) を利用しているだけですが。
使い方はこんな感じ。
OpenCover 2.1.15
PS>.\install.ps1 -url https://github.com/downloads/sawilde/opencover/opencover.2.1.15.msiNUnit 2.5.10.11092
PS>.\install.ps1 -url http://launchpad.net/nunitv2/2.5/2.5.10/+download/NUnit-2.5.10.11092.msi
MSBuild や Jenkins とかでの自動インストールも出来そうですね。