📄 JScript (WSH)

Get Computer System Product Info Report (JScript)

Queries Win32_ComputerSystemProduct via WMI and prints Computer System Product Info to the console — JScript, VBScript's WSH sibling language.

By WindowsScripting.com · 1.1 KB
GetComputerSystemProductReport.js
// ============================================================
// GetComputerSystemProductReport.js
//
// Reports Computer System Product Info via WMI (Win32_ComputerSystemProduct). JScript (Windows Script Host) —
// VBScript's sibling language, run the same way via cscript/wscript.
//
// Usage: cscript GetComputerSystemProductReport.js
// ============================================================

var objWMIService = GetObject("winmgmts:\\\\.\\root\\cimv2");
var colItems = objWMIService.ExecQuery("SELECT Name, Vendor, Version, IdentifyingNumber FROM Win32_ComputerSystemProduct");

var e = new Enumerator(colItems);
var output = "";
var count = 0;

for (; !e.atEnd(); e.moveNext()) {
    var item = e.item();
    output += "Name: " + item.Name + "\n";
    output += "Vendor: " + item.Vendor + "\n";
    output += "Version: " + item.Version + "\n";
    output += "IdentifyingNumber: " + item.IdentifyingNumber + "\n";
    output += new Array(41).join("-") + "\n";
    count++;
}

if (count === 0) {
    WScript.Echo("No Computer System Product Info found.");
} else {
    WScript.Echo(output);
}