I am trying to write code that will allow me to detect precisely what edition of Windows Vista I am running under (e.g. "Home Basic", "Home Premium" etc). The old code I used for XP and earlier does not go far enough (Sysinfo control and GetVersionEx API call).
The option with the best potential appears to be the OperatingSystemSKU property of the Win32_OperatingSystem WMI class . This code works:
The problem is that, if there are multiple operating systems installed, this will loop through the lot. What I need to be able to do is identify the operating system instance that I am running from and process only that instance.
Any help would be greatly nappreciated.
The option with the best potential appears to be the OperatingSystemSKU property of the Win32_OperatingSystem WMI class . This code works:
Code:
Dim objOS As Object
For Each objOS In GetObject( _
"winmgmts:").InstancesOf("Win32_OperatingSystem")
MsgBox "Caption = " & objOS.Caption & vbCr _
& "Version = " & objOS.Version & vbCr _
& "Name = " & objOS.Name & vbCr _
& "Creation Class = " & objOS.CreationClassName & vbCr _
& "Type = " & objOS.ostype & vbCr _
& "Registered User = " & objOS.RegisteredUser & vbCr _
& "System device = " & objOS.SystemDevice & vbCr _
& "Install Date = " & objOS.InstallDate & vbCr _
& "Manufacturer = " & objOS.Manufacturer
' If .dwMajorVersion >= 6 Then
If objOS.Version >= "6" Then
MsgBox "Vista flavour is " & objOS.OperatingSystemSKU
End If
Next
Any help would be greatly nappreciated.