The following code retrieves a string containing the name of the Windows OS variant installed on the machine in question. It uses WMI to do this, so non-Windows OS machines will not respond.
'
' Get Operating System Name
'
'
function getOSName(strComputer)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_OperatingSystem",,48)
For Each objItem in colItems
theValue = objItem.Caption
Next
getOSName = theValue
end function
