获取操作系统属性[WSH][计算机管理]

类别:编程语言 点击:0 评论:0 推荐:

获取操作系统属性[WSH][计算机管理][Windows Script Host]

TechNet 脚本中心:获取操作系统属性

描述信息

获取有关计算机上所安装的操作系统信息,其中包括语言种类、加密级别和内建编号等。

脚本代码

Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime") strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems Wscript.Echo "Boot Device: " & objOperatingSystem.BootDevice Wscript.Echo "Build Number: " & objOperatingSystem.BuildNumber Wscript.Echo "Build Type: " & objOperatingSystem.BuildType Wscript.Echo "Caption: " & objOperatingSystem.Caption Wscript.Echo "Code Set: " & objOperatingSystem.CodeSet Wscript.Echo "Country Code: " & objOperatingSystem.CountryCode Wscript.Echo "Debug: " & objOperatingSystem.Debug Wscript.Echo "Encryption Level: " & objOperatingSystem.EncryptionLevel dtmConvertedDate.Value = objOperatingSystem.InstallDate dtmInstallDate = dtmConvertedDate.GetVarDate Wscript.Echo "Install Date: " & dtmInstallDate Wscript.Echo "Licensed Users: " & _ objOperatingSystem.NumberOfLicensedUsers Wscript.Echo "Organization: " & objOperatingSystem.Organization Wscript.Echo "OS Language: " & objOperatingSystem.OSLanguage Wscript.Echo "OS Product Suite: " & objOperatingSystem.OSProductSuite Wscript.Echo "OS Type: " & objOperatingSystem.OSType Wscript.Echo "Primary: " & objOperatingSystem.Primary Wscript.Echo "Registered User: " & objOperatingSystem.RegisteredUser Wscript.Echo "Serial Number: " & objOperatingSystem.SerialNumber Wscript.Echo "Version: " & objOperatingSystem.Version Next

本文地址:http://com.8s8s.com/it/it28848.htm