Possible solutions
Below there's a few batch scripts which can check whether the operating system is Windows 8.1, with or without KB2919355. The exit code will be one of the following:
0
: Windows 8.1
1
: Windows 8.1 Update (KB2919355 installed)
2
: Not Windows 8.1
Batch script A - Update check
This is the most reliable way. The script first checks if the operating system is Windows 8.1 by comparing the version with 6.3.9600
. Then all installed updates are queried to verify whether the KB2919355 update was installed already.
@echo off
for /f "usebackq tokens=2 delims==" %%G in (
`wmic os get version /value ^| findstr /c:"="`
) do set version=%%~G
if not "%version%" == "6.3.9600" exit /b 2
wmic qfe get hotfixid | findstr /i /c:"KB2919355" >nul
set /a errorlevel=%errorlevel% ^^ 1
exit /b %errorlevel%
Batch script B - Build version check
As an alternative you could check the Windows build version, which is faster then the first script because you don't need to enumerate all updates. Since it uses a registry value, it might not be as reliable.
@echo off
for /f "usebackq tokens=2 delims==" %%G in (
`wmic os get version /value ^| findstr /c:"="`
) do set version=%%~G
if not "%version%" == "6.3.9600" exit /b 2
for /f "tokens=4 delims=. " %%G in (
'"reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "BuildLabEx" | findstr /i /c:"REG_SZ" "'
) do set /a build=%%~G
if %build% geq 17031 exit /b 1
exit /b 0
Batch script C - Build version check (Internet Explorer)
Just like the previous script, here the concept is similar except the Internet Explorer (IE) version is checked instead.
@echo off
for /f "usebackq tokens=2 delims==" %%G in (
`wmic os get version /value ^| findstr /c:"="`
) do set version=%%~G
if not "%version%" == "6.3.9600" exit /b 2
for /f "tokens=3,6 delims=. " %%G in (
'"reg query "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v "svcVersion" | findstr /i /c:"REG_SZ" "'
) do set /a major=%%~G & set /a build=%%~H
if %major% equ 11 if %build% geq 17031 exit /b 1
if %major% geq 12 exit /b 1
exit /b 0
Note The script assumes that any IE version higher or equal to 12 to be available on a Windows 8.1 system with update KB2919355 installed.
All future security and nonsecurity updates for Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2 require this update to be installed. We recommend that you install this update on your Windows RT 8.1, Windows 8.1, or Windows Server 2012 R2-based computer in order to receive continued future updates.
Source: Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2 Update: April 2014
Given the above, it's reasonable to think any newer IE version would require the update as a prerequisite, just like SP2 is required to install IE 9 on Windows Vista.
ver
output (6.3.9600), and is the same for both. The problem I'm trying to solve is just knowing what systems we have in our lab, and what OS they're running . . . for full test coverage, we want to keep both 8.1 and 8.1 with Update 1ver
output and the registry info are identical. The wmic/findstr method seems like it'll work (even on systems that were installed from the new ISOs), though it's ugly as sin (especially since it's basically going to be a secondary check after aver
check) . . . post that as an answer and I'll accept it . . .