Get operating system properties [WSH] [Computer Management] [Windows Script Host]
TECHNET Script Center: Get operating system properties
Description
Get the operating system information installed on your computer, including language types, encryption levels, and built-in numbers.
Script code
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 Objoteingsystem in coloperatingsystems
WScript.echo "Boot Device:" & objoodablesystem.bootDevice
WScript.echo "Build Number:" & objoteingsystem.buildnumber
WScript.echo "Build Type:" & objoteingsystem.buildtype
WScript.echo "CAPTION:" & objoteingsystem.caption
WScript.echo "Code Set:" & objoteingsystem.codset
WScript.echo "Country Code:" & objoteingsystem.countrycode
WScript.echo "Debug:" & objoteingsystem.debug
WScript.echo "Encryption Level:" & objoodingSystem.EncryptionLevel
DTMCONVERTEDDATE.VALUE = Objoteingsystem.installDate
DTMinstallDate = DTMCONVERTEDDATE.GETVARDATE
WScript.echo "Install Date:" & DTMInstallDate
WScript.echo "licensed users:" & _
Objoteingsystem.numberoflicensedusers
WScript.echo "Organization:" & objoteingsystem.organization
Wscript.echo "OS Language:" & objoodablesystem.oslanguage
WScript.echo "OS Product Suite:" & objoteingsystem.osproductsuite
WScript.echo "OS Type:" & objoteingsystem.Ostype
Wscript.echo "Primary:" & objoodativesystem.primarywscript.echo "Registered User:" & objoteingsystem.registerUser
WScript.echo "Serial Number:" & objoteingsystem.serialnumber
WScript.echo "Version:" & objoteingsystem.version
NEXT