This script will fetch the latest release of the Orion SDK from Github and install it.
I did this script to help building lab VMs. Needs some refinement, but it's a good start.
<#
Script: Install_OrionSDK.ps1
Author: PLanglois
Version: 1.0
No arguments needed. This script will fetch the latest release of OrionSDK on Github.
To Do:
* Validate if SWQL Studio is already installed and if version is lower than target.
* Enhance error handling
#>
#Requires -RunAsAdministrator
# Modern websites require TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Uri = "https://github.com/solarwinds/OrionSDK/releases/latest"
$Content = Invoke-WebRequest -Uri $Uri
#Extracting version number & building the download URL
$title = ($Content.AllElements | where {$_.TagName -eq "title"}).innertext
$FileToDownload = "OrionSDK.msi"
$version = [regex]::Matches($Title, '(v\d*\.\d*\.\d*)').value
$DownloadUrl = ("https://github.com/solarwinds/OrionSDK/releases/download/$version/$FileToDownload").Trim()
$OutputPath = ("$env:temp\$FileToDownload").Trim()
# Download the file to user's temp folder
Invoke-WebRequest -Uri $DownloadUrl -OutFile $OutputPath
# Install the program without user interaction (only show progress bar)
Start-Process -FilePath "C:\WINDOWS\system32\msiexec.exe" -ArgumentList "/package", $OutputPath, "/passive" -Wait