Created
December 6, 2018 06:26
-
-
Save puttyq/7b028303412cad2a2d2b272213305903 to your computer and use it in GitHub Desktop.
Simple script to download the latest GitHub release MSI file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$repo = "xxxx/xxxx" | |
$file = "xxxxx.msi" | |
$releases = "https://api.github.com/repos/$repo/releases" | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
$tag = (Invoke-WebRequest -Uri $releases -UseBasicParsing | ConvertFrom-Json)[0].tag_name | |
$download = "https://github.com/$repo/releases/download/$tag/$file" | |
$msi = "$name-$tag.msi" | |
# download | |
Invoke-WebRequest $download -Out $msi | |
Start-Process msiexec.exe -Wait -ArgumentList "/I $msi /quiet" | |
if (Get-Module -ListAvailable -Name LithnetMIISAutomation) { | |
Write-Host ("Module installed") | |
exit 0 | |
} else { | |
Write-Host ("Module installation failed") | |
exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment