📜 VBScript (WSH)

System Info Report

Collects OS, CPU, RAM, and BIOS information via WMI and writes a plain-text inventory report, no PowerShell required.

By WindowsScripting.com · 2.3 KB
SystemInfoReport.vbs
' ============================================================
' SystemInfoReport.vbs
'
' Collects basic system information (OS, CPU, RAM, BIOS) via WMI
' and writes a plain-text report next to the script. Handy for a
' quick inventory snapshot on machines without PowerShell access.
'
' Usage:
'   cscript SystemInfoReport.vbs
' ============================================================

Option Explicit

Dim objWMIService, objItem, objItems
Dim objFSO, objFile
Dim strComputer, strReport, strOutPath

strComputer = "."
strReport = "System Information Report" & vbCrLf
strReport = strReport & "Generated: " & Now & vbCrLf
strReport = strReport & String(50, "-") & vbCrLf

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

' --- Operating System ---
Set objItems = objWMIService.ExecQuery("SELECT Caption, Version, OSArchitecture, LastBootUpTime FROM Win32_OperatingSystem")
For Each objItem In objItems
    strReport = strReport & "OS: " & objItem.Caption & " (" & objItem.OSArchitecture & "), version " & objItem.Version & vbCrLf
Next

' --- Processor ---
Set objItems = objWMIService.ExecQuery("SELECT Name, NumberOfCores, NumberOfLogicalProcessors FROM Win32_Processor")
For Each objItem In objItems
    strReport = strReport & "CPU: " & objItem.Name & " (" & objItem.NumberOfCores & " cores / " & _
                objItem.NumberOfLogicalProcessors & " threads)" & vbCrLf
Next

' --- Memory ---
Dim totalRAM
totalRAM = 0
Set objItems = objWMIService.ExecQuery("SELECT Capacity FROM Win32_PhysicalMemory")
For Each objItem In objItems
    totalRAM = totalRAM + CDbl(objItem.Capacity)
Next
strReport = strReport & "RAM: " & Round(totalRAM / 1024 / 1024 / 1024, 2) & " GB" & vbCrLf

' --- BIOS ---
Set objItems = objWMIService.ExecQuery("SELECT Manufacturer, SerialNumber FROM Win32_BIOS")
For Each objItem In objItems
    strReport = strReport & "BIOS: " & objItem.Manufacturer & ", Serial: " & objItem.SerialNumber & vbCrLf
Next

' --- Write report to file next to the script ---
Set objFSO = CreateObject("Scripting.FileSystemObject")
strOutPath = objFSO.GetParentFolderName(WScript.ScriptFullName) & "\SystemInfoReport_" & _
             Replace(FormatDateTime(Now, 2), "/", "-") & ".txt"

Set objFile = objFSO.CreateTextFile(strOutPath, True)
objFile.Write strReport
objFile.Close

WScript.Echo strReport
WScript.Echo "Report saved to: " & strOutPath