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.

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"

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: