Skip to content

Instantly share code, notes, and snippets.

@puttyq
Created December 6, 2018 06:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puttyq/7b028303412cad2a2d2b272213305903 to your computer and use it in GitHub Desktop.
Save puttyq/7b028303412cad2a2d2b272213305903 to your computer and use it in GitHub Desktop.
Simple script to download the latest GitHub release MSI file
$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