Share via


How to identify Windows version and edition with VBS

Do you need to identify the OS version and edition?

I really needed this when I make a install package application.

So, I looked it up from the web and this was really useful for me.

https://www.msfn.org/board/How-to-identify-exact-Windows-Version-t59477.html

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
Msgbox objOperatingSystem.Caption & " " & _
objOperatingSystem.Version, 0 + 32,"Window Version"
Next

And we can see the vaules from the registry value under this:

HKLM\Software\Microsoft\Windows NT\Current Version

 

And some useful VBS reference site is:

https://www.pctools.com/guides/scripting/id/25/?act=reference

Comments