Pages

Friday 15 June 2012

Get System Information - VBScript


Set oSystemSet = GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")


For Each oSystem in oSystemSet


 system_name = oSystem.Caption 
 system_type = oSystem.SystemType
 system_mftr = oSystem.Manufacturer
 system_model = oSystem.Model
Next


Set oProcSet = GetObject("winmgmts:").InstancesOf("Win32_Processor")


For Each oSystem in oProcSet
 proc_desc = oSystem.Caption 
 proc_mftr = oSystem.Manufacturer
 proc_mhz = oSystem.CurrentClockSpeed
Next


Set oBiosSet = GetObject("winmgmts:").InstancesOf("Win32_BIOS")


For Each oSystem in oBiosSet
      bios_info = oSystem.Version
Next


Set oZoneSet = GetObject("winmgmts:").InstancesOf("Win32_TimeZone")


For Each oSystem in oZoneSet
      loc_timezone = oSystem.StandardName
Next


Set oOSSet = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")


For Each oSystem in oOSSet


 os_name = oSystem.Caption
 os_version = oSystem.Version
 os_mftr = oSystem.Manufacturer
 os_build = oSystem.BuildNumber
 os_dir = oSystem.WindowsDirectory
 os_locale = oSystem.Locale
 os_totalmem = oSystem.TotalVisibleMemorySize
 os_freemem = oSystem.FreePhysicalMemory
 os_totalvirmem = oSystem.TotalVirtualMemorySize
 os_freevirmem = oSystem.FreeVirtualMemory
 os_pagefilesize = oSystem.SizeStoredInPagingFiles


Next


sMsg = ("OS Name:  " & os_name & Chr(10))
sMsg = sMsg & ("Version:  " & os_version & " Build " & os_build & Chr(10))
sMsg = sMsg & ("OS Manufacturer:  " & os_mftr & Chr(10))
sMsg = sMsg & ("oSystem Name:  " & system_name & Chr(10))
sMsg = sMsg & ("oSystem Manufacturer:  " & system_mftr & Chr(10))
sMsg = sMsg & ("oSystem Model:  " & system_model & Chr(10))
sMsg = sMsg & ("oSystem Type:  " & system_type & Chr(10))
sMsg = sMsg & ("Processor:  " & proc_desc & " " & proc_mftr & " ~" & proc_mhz & "Mhz" & Chr(10))
sMsg = sMsg & ("BIOS Version:  " & bios_info & Chr(10))
sMsg = sMsg & ("Windows Directory:  " & os_dir & Chr(10))
sMsg = sMsg & ("Locale:  " & os_locale & Chr(10))  
sMsg = sMsg & ("Time Zone:  " & loc_timezone & Chr(10))
sMsg = sMsg & ("Total Physical Memory:  " & os_totalmem & "KB" & Chr(10))
sMsg = sMsg & ("Available Physical Memory:  " & os_freemem & "KB" & Chr(10))
sMsg = sMsg & ("Total Virtual Memory:  " & os_totalvirmem & "KB" & Chr(10))
sMsg = sMsg & ("Available Virtual Memory:  " & os_freevirmem & "KB" & Chr(10))
sMsg = sMsg & ("Page File Space : " & os_pagefilesize & "KB" & Chr(10))


MsgBox sMsg, 0,"System Summary Information"

No comments:

Post a Comment