Dim strComputer As String
strComputer = "."
Dim objWMIService As SWbemServices
Dim colOperatingSystems As SWbemObjectSet
Dim objOperatingSystem As SWbemObject
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
MsgBox objOperatingSystem.Version
Next
strComputer = "."
Dim objWMIService As SWbemServices
Dim colOperatingSystems As SWbemObjectSet
Dim objOperatingSystem As SWbemObject
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
MsgBox objOperatingSystem.Version
Next
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=492978