So are you saying that when you actually try to do this there are issues that would not be found by a simple google search?That's a console command, there's not a Windows function that directly gets just the relevant info.The cmd 'systeminfo', which works since at least win7 (Im fairly sure), returns everything on the OS, including the state of installed KBs. This isnt adequate for an application to call for OS detection?
There are faster and simpler versions. ver returns just the version string, although you have to check the build number to distinguish between Windows 10, Windows 11, and Windows Server 2016/2019/2022 (they all report as "Windows 10.0.xxxxx.yyyy")
If you have at least Windows 7 (or equivalent), in Powershell there's (gwmi -class Win32_OperatingSystem).Caption which returns a human-readable string. Of course, if your requirement is "at least Windows 7" the absence of PowerShell is a clue.
An EXE application (e.g. an installer created with InstallShield or similar) could ShellExecute any of these commands (piping the output to a text file), open that text file and parse the string... and assuming Microsoft doesn't change the format in a future update (which they don't guarantee), determine the version from that. That was the method I was considering and rejected. But a pure MSI installer can't do that.Winver is a desktop app, that's a no-go for an installer. And it isn't included in some Windows Server versions.There is also the 'winver' cmd.
I've seen plenty of software which prevents installing on outdated Windows so it must be possible.
I'm not saying it's not possible, it's just kind of annoying and not necessarily 100% reliable and future-proof. And you can't do it with an MSI unless you're checking for expected registry entries.
Statistics: Posted by BobDog — Tue Jul 30, 2024 6:53 pm