#888: Detection of QGIS install (via OSGeo4W installer) for mass deployment ---------------------------+---------------------------- Reporter: ascottwwf | Owner: osgeo4w-dev@… Type: enhancement | Status: new Priority: normal | Component: Package Version: | Resolution: Keywords: QGIS detection | ---------------------------+---------------------------- Comment (by ascottwwf):
Thanks Both, Although this solution doesn't meet the exact requirements layed out above - I'd have preferred a File Version attribute being addded to one or more key executables or DLLs like this example of the 7-Zip File manager (`7zFM.exe`):\\ {{{ Get-ChildItem "C:\Program Files\7-Zip\7zFM.exe" -Recurse -Force -ErrorAction SilentlyContinue | Select-Object * -ExpandProperty versioninfo | Sort-Object ProductVersion,FileVersionRaw,Filename | Select- Object ProductVersion,FileVersionRaw,Filename,FileDescription,CompanyName,LegalCopyright | ft -AutoSize ProductVersion FileVersionRaw FileName FileDescription CompanyName LegalCopyright -------------- -------------- -------- --------------- ----------- -------------- 24.09 24.9.0.0 C:\Program Files\7-Zip\7zFM.exe 7-Zip File Manager Igor Pavlov Copyright (c) 1999-2024 Igor Pavlov }}} But, I had overlooked the fact that Intune has a ''`'use a custom detection script'`'' option.\\ So thanks for your guidance, I have added a piece of code to my packaging script that will auto-generate a PowerShell QGIS detection script each time a new version is detected, which injects the value for the QGIS latest version at the begining of the script (Currently 3.40.8).\\ This detection script confirms the version being deployed has successfully been installed (by matching the `$LatestVersion` variable and the version found on the line begining 'qgis-ltr qgis-ltr-') within the `installed.db` file.\\ N.B. `exit 0` returns success to Intune and `exit 1` returns failure to Intune\\ This means I have a repeatable method to detect newly deployed versions (so long as the path to (or the structure of) the `installed.db` file doesn't change) In case you are interested, here is my script: {{{ $LatestVersion = "3.40.8" # Define path to installed.db $installedDbPath = "C:\Program Files\OSGeo4W_v2\etc\setup\installed.db" # Verify file exists if (-Not (Test-Path -Path $installedDbPath)) { Write-Output "installed.db not found at $installedDbPath" exit 1 } # Read installed.db and find the line that starts with 'qgis-ltr qgis- ltr-' $qgisLine = Get-Content -Path $installedDbPath | ForEach-Object { $_.Trim() } | Where-Object { $_ -match "^qgis-ltr qgis-ltr-" } if (-not $qgisLine) { Write-Output "QGIS LTR version not found" exit 1 } # Extract the version string using regex if ($qgisLine -match "^qgis-ltr qgis-ltr-([\d\.]+)-\d+\.tar\.bz2") { [version]$InstalledVersion = $matches[1] Write-Output "QGIS LTR version detected: $InstalledVersion" If([version]$InstalledVersion -ge [version]$LatestVersion){ Write-Output "SUCCESS :: Latest Version $($LatestVersion) Installed" exit 0 } else { Write-Output "FAILURE :: Latest Version $($LatestVersion) Not Installed" exit 1 } } else { Write-Output "Unable to parse QGIS LTR version from line: $qgisLine" exit 1 } }}} Feel free to close this ticket, as I can work with this. Thanks again -- Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/888#comment:4> OSGeo4W <http://trac.osgeo.org/osgeo4w> OSGeo4W is the Windows installer and package environment for the OSGeo stack.
_______________________________________________ osgeo4w-dev mailing list osgeo4w-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/osgeo4w-dev