cls $ibv="" $imuv="" $wbv="" $wmuv="" $ScriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition $ClientPath = $ScriptPath +"\Fusion 360 Client Downloader.exe" $InstalledInfofile = $ScriptPath + "\Installedfusioninfo.json" $WebSource = " https://dl.appstreaming.autodesk.com/production/67316f5e79bc48318aa5f7b6bb58243d/73e72ada57b7480280f7a6f4a289729f/full.json" $WebDest = $ScriptPath + "\full.json" $FusionVerlog = "C:\Windows\temp\Fusion360Ver.log" # location of version log $datetime = Get-Date -Format "dd/MM/yyyy HH:mm:ss" if (Test-Path $InstalledInfofile){ Remove-Item $InstalledInfofile} if (Test-Path $WebDest){ Remove-Item $WebDest} # Get Installed Version Numbers Start-Process -FilePath $ClientPath -ArgumentList "--globalinstal --process query --quiet --infofile $InstalledInfofile" -NoNewWindow -Wait $iseparator1 = 'build-version": ' #what to look for $iseparator2 = 'major-update-version": "' #what to look for again $icontent = (Get-Content $InstalledInfofile -Raw) #grab the content $ipos1 = $iContent.IndexOf($iseparator1) #find the first content $ibv = $icontent.Substring($ipos1+$iseparator1.Length+1,8) #assumes version is 8 characters $ipos2 = $icontent.IndexOf($iseparator2) #find the second content $imuv` = $icontent.Substring($ipos2+$iseparator2.Length,8) #assumes version is 8 characters write-host `n write-host "Installed Build Version: " $ibv write-host "Installed Major-Update Version: " $imuv # Get Web Version Numbers $wc = New-Object System.Net.WebClient $wc.DownloadFile($WebSource,$WebDest) $wseparator1 = 'build-version":' #what to look for $wseparator2 = 'major-update-version":"' #what to look for again $wcontent = get-content $WebDest #grab the content $wpos = $wcontent.IndexOf($wseparator1) #find the first content $wbv = $wcontent.Substring($wpos+$wseparator1.Length+1,8) #assumes version is 8 characters $wpos2 = $wcontent.IndexOf($wseparator2) #find the second content $wmuv = $wcontent.Substring($wpos2+$wseparator2.Length,8) #assumes version is 8 characters write-host `n write-host "Current Web Build Version: " $wbv write-host "Current Web Major-Update Version: "$wmuv If ($ibv -eq ""){ Write-Host `n Write-Host "Installed Version Detection Error!" "$datetime, Installed Version Detection Error!" >> $FusionVerlog exit} ElseIf ($wbv -eq "") { Write-Host `n Write-Host "Web Version Detection Error!" "$datetime, Web Version Detection Error!" >> $FusionVerlog } ElseIf ($wbv -eq $ibv) { Write-Host `n Write-Host "Current Version Installed." "$datetime, Current Version Installed, Version Number: $ibv " >> $FusionVerlog } ElseIf ($wbv -gt $ibv) { Write-Host `n Write-Host "Update Available." Start-Process -FilePath $ClientPath -ArgumentList "--globalinstall --process update --quiet" -NoNewWindow -Wait Write-Host "Update Installed." "$datetime, Updated Version Avalable & Installed, Version: $ibv Updated to Version: $wbv " >> $FusionVerlog } Else { Write-Host `n Write-Host "Error!" "$datetime, Error!" >> $FusionVerlog }