答案 0 :(得分:8)
这是另一个版本:
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each os in oss
Wscript.Echo "Boot Device: " & os.BootDevice
Wscript.Echo "Build Number: " & os.BuildNumber
Wscript.Echo "Build Type: " & os.BuildType
Wscript.Echo "Caption: " & os.Caption
Wscript.Echo "Code Set: " & os.CodeSet
Wscript.Echo "Country Code: " & os.CountryCode
Wscript.Echo "Debug: " & os.Debug
Wscript.Echo "Encryption Level: " & os.EncryptionLevel
dtmConvertedDate.Value = os.InstallDate
dtmInstallDate = dtmConvertedDate.GetVarDate
Wscript.Echo "Install Date: " & dtmInstallDate
Wscript.Echo "Licensed Users: " & os.NumberOfLicensedUsers
Wscript.Echo "Organization: " & os.Organization
Wscript.Echo "OS Language: " & os.OSLanguage
Wscript.Echo "OS Product Suite: " & os.OSProductSuite
Wscript.Echo "OS Type: " & os.OSType
Wscript.Echo "Primary: " & os.Primary
Wscript.Echo "Registered User: " & os.RegisteredUser
Wscript.Echo "Serial Number: " & os.SerialNumber
Wscript.Echo "Version: " & os.Version
Next
结果:
Microsoft Windows XP Professional
版本:5.1.2600
答案 1 :(得分:5)
来自here:
' Copyright (c) 1997-1999 Microsoft Corporation
'************************************************************************** *
'
' WMI Sample Script - Information about the OS (VBScript)
'
' This script demonstrates how to retrieve the info about the OS on the local machine from instances of
' Win32_OperatingSystem.
'
'************************************************************************** *
Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
for each System in SystemSet
WScript.Echo System.Caption
WScript.Echo System.Manufacturer
WScript.Echo System.BuildType
WScript.Echo " Version: " + System.Version
WScript.Echo " Locale: " + System.Locale
WScript.Echo " Windows Directory: " + System.WindowsDirectory
WScript.Echo " Total memory: " + System.TotalVisibleMemorySize + " bytes"
WScript.Echo " Serial Number: " + System.SerialNumber
Wscript.Echo ""
next
第一个消息框为我提供了“Microsoft Windows 7 Professional”。