osQuery Management Server (Prime).OS Version (Windows) (SQLite SQL Statements)


    WITH display_version_table AS (
      SELECT data as display_version
      FROM registry
      WHERE path = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion'
    ),
    ubr_table AS (
      SELECT data AS ubr
      FROM registry
      WHERE path ='HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\UBR'
    )
    SELECT
      os.name,
      COALESCE(d.display_version, '') AS display_version,
      COALESCE(CONCAT((SELECT version FROM os_version), '.', u.ubr), k.version) AS version
    FROM
      os_version os,
      kernel_info k
    LEFT JOIN
      display_version_table d
    LEFT JOIN
      ubr_table u;