From 7509cb7d8612d1731be3b686bea0da3cd36faa86 Mon Sep 17 00:00:00 2001 From: Nicole Rappe Date: Thu, 9 Oct 2025 17:46:25 -0600 Subject: [PATCH] Updated OS Detection Logic --- Data/Agent/Roles/role_DeviceAudit.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Data/Agent/Roles/role_DeviceAudit.py b/Data/Agent/Roles/role_DeviceAudit.py index 841fbe5..3d51a5b 100644 --- a/Data/Agent/Roles/role_DeviceAudit.py +++ b/Data/Agent/Roles/role_DeviceAudit.py @@ -68,7 +68,15 @@ def detect_agent_os(): else: major_label = platform.release() - os_name = f"Windows {major_label}" + # Prefer the registry product name so Windows Server editions keep their + # native branding (e.g., "Windows Server 2022 Standard"). Fall back to + # the major label when the product name is unavailable. + base_name = (product_name or "").strip() + if not base_name: + base_name = f"Windows {major_label}".strip() + elif not base_name.lower().startswith("windows"): + base_name = f"Windows {major_label} {base_name}".strip() + version_label = display_version or release_id or "" if isinstance(ubr, int): build_str = f"{build_number}.{ubr}" if build_number else str(ubr) @@ -78,14 +86,7 @@ def detect_agent_os(): except Exception: build_str = build_number or "" - parts = [os_name] - if product_name and product_name.lower().startswith('windows '): - try: - tail = product_name.split(' ', 2)[2] - if tail: - parts.append(tail) - except Exception: - pass + parts = [base_name] if version_label: parts.append(version_label) if build_str: