There are several ways one can get the name of the OS you are working with. One rather unusual method is from win32_process. The property is called simply, osname. The bad news, is it also returns the path to where this "instance" of the OS resides. No problem, I thought. I will simply parse out the extra info, and have a cute script.
'On Error Resume Next
Dim objOSname, strResult, strLen, strTrim
strComputer = "."
wmiNS = "\root\cimv2"
wmiQuery = "Select osname from win32_process"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
Set colItems = objWMIService.execquery(wmiQuery)
for Each objItem in colItems
'Wscript.Echo ": " & objItem.osname
objOSname = objItem.osname
Function strOSname (objOSname)
strResult = InStr(objOSname, "|")
strTrim = strResult -1
strOSname = Mid(objOSname, 1, strTrim)