-
-
Save annymosse/5421fc038764022355d85ced8dc634fd to your computer and use it in GitHub Desktop.
VBScript to gather windows computer information via WMI. Can take a Run it with:cscript cinfo.vbs COMPUTERNAMEORcscript cinfo.vbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Wscript.Arguments.count > 0 then | |
strComputer = Wscript.Arguments(0) | |
else | |
Wscript.StdOut.Write "Please enter a computer name: " | |
strComputer = Wscript.StdIn.ReadLine | |
end if | |
Set objWMIService = GetObject("winmgmts:" _ | |
& "{impersonationLevel=impersonate}!\\" _ | |
& strComputer & "\root\cimv2") | |
Set colSettings = objWMIService.ExecQuery _ | |
("Select * from Win32_ComputerSystem") | |
Set colSMBIOS = objWMIService.ExecQuery _ | |
("Select * from Win32_SystemEnclosure") | |
Set colItems = objWMIService.ExecQuery(_ | |
"Select * from Win32_Processor") | |
Set shell = CreateObject("WScript.Shell") | |
Set getOSVersion = shell.exec("%comspec% /c ver") | |
version = getOSVersion.stdout.readall | |
Select Case True | |
Case InStr(version, "n 5.0") > 1 : GetOS = "Windows 2000" | |
Case InStr(version, "n 5.1") > 1 : GetOS = "Windows XP" | |
Case InStr(version, "n 6.0") > 1 : GetOS = "Windows Vista" | |
Case InStr(version, "n 6.1") > 1 : GetOS = "Windows 7" | |
Case InStr(version, "n 6.2") > 1 : GetOS = "Windows 8" | |
Case Else : GetOS = "Unknown" | |
End Select | |
wscript.echo GetOS | |
For Each objComputer in colSettings | |
Wscript.Echo "System Name: " & objComputer.Name | |
Wscript.Echo "Total Physical Memory: " & _ | |
Round(objComputer.TotalPhysicalMemory / 1073741824, 2) & "GB Usable" | |
Next | |
For Each objSMBIOS in colSMBIOS | |
Wscript.Echo "Serial Number: " _ | |
& objSMBIOS.SerialNumber | |
Next | |
For Each objItem in colItems | |
Wscript.Echo "Processor Name: " & objItem.Name | |
Wscript.Echo "Maximum Clock Speed: " _ | |
& Round(objItem.MaxClockSpeed / 1000, 1) & " GHz" | |
Next | |
wscript.echo version | |
'still under test -------------------------- | |
On Error Resume Next | |
strComputer = "." | |
Set objWMIService = GetObject("winmgmts:" _ | |
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") | |
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor") | |
For Each objItem in colItems | |
Wscript.Echo "Address Width: " & objItem.AddressWidth | |
Wscript.Echo "Architecture: " & objItem.Architecture | |
Wscript.Echo "Availability: " & objItem.Availability | |
Wscript.Echo "CPU Status: " & objItem.CpuStatus | |
Wscript.Echo "Current Clock Speed: " & objItem.CurrentClockSpeed | |
Wscript.Echo "Data Width: " & objItem.DataWidth | |
Wscript.Echo "Description: " & objItem.Description | |
Wscript.Echo "Device ID: " & objItem.DeviceID | |
Wscript.Echo "External Clock: " & objItem.ExtClock | |
Wscript.Echo "Family: " & objItem.Family | |
Wscript.Echo "L2 Cache Size: " & objItem.L2CacheSize | |
Wscript.Echo "L2 Cache Speed: " & objItem.L2CacheSpeed | |
Wscript.Echo "Level: " & objItem.Level | |
Wscript.Echo "Load Percentage: " & objItem.LoadPercentage | |
Wscript.Echo "Manufacturer: " & objItem.Manufacturer | |
Wscript.Echo "Maximum Clock Speed: " & objItem.MaxClockSpeed | |
Wscript.Echo "Name: " & objItem.Name | |
Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID | |
Wscript.Echo "Processor ID: " & objItem.ProcessorId | |
Wscript.Echo "Processor Type: " & objItem.ProcessorType | |
Wscript.Echo "Revision: " & objItem.Revision | |
Wscript.Echo "Role: " & objItem.Role | |
Wscript.Echo "Socket Designation: " & objItem.SocketDesignation | |
Wscript.Echo "Status Information: " & objItem.StatusInfo | |
Wscript.Echo "Stepping: " & objItem.Stepping | |
Wscript.Echo "Unique Id: " & objItem.UniqueId | |
Wscript.Echo "Upgrade Method: " & objItem.UpgradeMethod | |
Wscript.Echo "Version: " & objItem.Version | |
Wscript.Echo "Voltage Caps: " & objItem.VoltageCaps | |
Next | |
-------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment