$R = Invoke-WebRequest -Uri https://s3.amazonaws.com/info-mongodb-com/com-download-center/compass.json $J = ConvertFrom-Json $R.Content $LINK = "" echo "Determining latest version of Compass..." for ($i = 0; $i -lt $J.versions.Length; $i++) { if ($J.versions[$i].version -like "*(Stable)*") { for ($x = 0; $x -lt $J.versions[$i].platform.Length; $x++) { if ($J.versions[$i].platform[$x].name -eq "Windows 64-bit (7+)") { $LINK = $J.versions[$i].platform[$x].download_link } } } } echo "Downloading Compass...." Invoke-WebRequest -Uri $LINK -OutFile ".\compass-install.exe" echo "Installing Compass..." .\compass-install.exe