@@ -719,6 +719,48 @@ def collect_windows(info_add):
719719except (ImportError, AttributeError):
720720pass
721721722+importsubprocess
723+try:
724+# When wmic.exe output is redirected to a pipe,
725+# it uses the OEM code page
726+proc=subprocess.Popen(["wmic", "os", "get", "Caption,Version", "/value"],
727+stdout=subprocess.PIPE,
728+stderr=subprocess.PIPE,
729+encoding="oem",
730+text=True)
731+output, stderr=proc.communicate()
732+ifproc.returncode:
733+output=""
734+exceptOSError:
735+pass
736+else:
737+forlineinoutput.splitlines():
738+line=line.strip()
739+ifline.startswith('Caption='):
740+line=line.removeprefix('Caption=').strip()
741+ifline:
742+info_add('windows.version_caption', line)
743+elifline.startswith('Version='):
744+line=line.removeprefix('Version=').strip()
745+ifline:
746+info_add('windows.version', line)
747+748+try:
749+proc=subprocess.Popen(["ver"], shell=True,
750+stdout=subprocess.PIPE,
751+stderr=subprocess.PIPE,
752+text=True)
753+output=proc.communicate()[0]
754+ifproc.returncode:
755+output=""
756+exceptOSError:
757+return
758+else:
759+output=output.strip()
760+line=output.splitlines()[0]
761+ifline:
762+info_add('windows.ver', line)
763+722764723765defcollect_fips(info_add):
724766try: