WebExeBuilder Documentation

getSysInfo

Category: System Integration

Namespace: web.system.getSysInfo

Description

Retrieves comprehensive system information including hardware specifications, operating system details, processor information, memory, and system configuration.

Syntax

const sysInfo = await web.system.getSysInfo();

Parameters

None

Returns

Promise<Object> - Returns a promise that resolves with a system information object containing:

{
    uniqueSystemId: string,           // Unique identifier for this system
    computerName: string,             // Computer name (e.g., "DESKTOP-ABC123")
    userName: string,                 // Current user name (e.g., "JohnDoe")
    osName: string,                   // Operating system name (e.g., "Windows 10 Pro")
    osVersion: string,                // Operating system version (e.g., "10.0.19045")
    processorName: string,            // Processor name and model (e.g., "Intel Core i7-9700K")
    processorArchitecture: string,    // Processor architecture (e.g., "x64")
    baseBoardManufacturer: string,    // Motherboard manufacturer
    biosVersion: string,              // BIOS version
    totalPhysicalMemory: string,      // Total physical memory in bytes
    availablePhysicalMemory: string,  // Available physical memory in KB
    systemType: string,               // System type (x86, x64, etc.)
    systemDirectory: string,          // Windows system directory path
    windowsDirectory: string          // Windows directory path
}

Examples

Simple example

const sysInfo = await web.system.getSysInfo();
console.log('Computer:', sysInfo.computerName);
console.log('OS:', sysInfo.osName, sysInfo.osVersion);
console.log('Processor:', sysInfo.processorName);
console.log('Architecture:', sysInfo.processorArchitecture);

Display system information

const sysInfo = await web.system.getSysInfo();

document.getElementById('computer').textContent = 
    `${sysInfo.computerName} (User: ${sysInfo.userName})`;

document.getElementById('os').textContent = 
    `${sysInfo.osName} ${sysInfo.osVersion} (${sysInfo.systemType})`;
    
document.getElementById('processor').textContent = 
    `${sysInfo.processorName} (${sysInfo.processorArchitecture})`;
    
document.getElementById('memory').textContent = 
    `Available: ${sysInfo.availablePhysicalMemory} KB / Total: ${sysInfo.totalPhysicalMemory} bytes`;
    
document.getElementById('hardware').textContent = 
    `Motherboard: ${sysInfo.baseBoardManufacturer} | BIOS: ${sysInfo.biosVersion}`;

Check system requirements

async function checkSystemRequirements() {
    const sysInfo = await web.system.getSysInfo();
    
    // Check if 64-bit
    if (sysInfo.systemType !== 'x64' && sysInfo.processorArchitecture !== 'x64') {
        alert('This application requires 64-bit Windows');
        return false;
    }
    
    // Check available memory (in KB)
    const availableMemoryMB = parseInt(sysInfo.availablePhysicalMemory) / 1024;
    if (availableMemoryMB < 2048) {
        alert('Warning: Low available memory. At least 2 GB recommended.');
    }
    
    // Check total memory (in bytes)
    const totalMemoryGB = parseInt(sysInfo.totalPhysicalMemory) / (1024 * 1024 * 1024);
    if (totalMemoryGB < 8) {
        alert('Warning: This application works best with 8+ GB RAM');
    }
    
    return true;
}

await checkSystemRequirements();

Generate system report

async function generateSystemReport() {
    const sysInfo = await web.system.getSysInfo();
    
    const report = `System Information Report
Generated: ${new Date().toLocaleString()}

System Identification:
  Unique ID: ${sysInfo.uniqueSystemId}
  Computer Name: ${sysInfo.computerName}
  User Name: ${sysInfo.userName}

Operating System:
  Name: ${sysInfo.osName}
  Version: ${sysInfo.osVersion}
  Type: ${sysInfo.systemType}
  System Directory: ${sysInfo.systemDirectory}
  Windows Directory: ${sysInfo.windowsDirectory}

Processor:
  Name: ${sysInfo.processorName}
  Architecture: ${sysInfo.processorArchitecture}

Hardware:
  Motherboard: ${sysInfo.baseBoardManufacturer}
  BIOS Version: ${sysInfo.biosVersion}

Memory:
  Total Physical: ${sysInfo.totalPhysicalMemory} bytes
  Available Physical: ${sysInfo.availablePhysicalMemory} KB
`;

    // Save report to file
    await web.files.writeTextFile({
        filePath: 'system_report.txt',
        contents: report
    });
    
    console.log('System report saved');
}

await generateSystemReport();

Cache system info for performance

// Cache system info since it rarely changes
let cachedSysInfo = null;

async function getSystemInfo() {
    if (!cachedSysInfo) {
        try {
            cachedSysInfo = await web.system.getSysInfo();
        } catch (error) {
            console.error('Failed to get system info:', error);
            return null;
        }
    }
    return cachedSysInfo;
}

// Use cached version
const sysInfo = await getSystemInfo();
if (sysInfo) {
    console.log('Computer:', sysInfo.computerName);
    console.log('OS:', sysInfo.osName);
}

Use Cases

  • System Requirements Check - Verify if the system meets minimum requirements
  • Hardware Inventory - Collect detailed hardware information for support purposes
  • License Management - Use unique system ID for software licensing
  • Configuration Optimization - Adjust application settings based on system capabilities
  • Troubleshooting - Gather system information for debugging and support
  • Analytics - Collect anonymous system statistics for product improvement
  • Compatibility Testing - Ensure software works on target hardware configurations
  • Display system information in About dialog
  • Generate diagnostic reports for support tickets

Notes

  • Returns a comprehensive JSON object with system details
  • Information is gathered from Windows system APIs (WMI queries)
  • All values are returned as strings
  • Returns null if system information cannot be retrieved
  • Memory units: totalPhysicalMemory is in bytes, availablePhysicalMemory is in KB
  • Unique ID: The uniqueSystemId is deterministic but unique per installation
  • Privacy: Be transparent with users about collecting system information
  • Performance: Cache results as system info rarely changes during execution
  • Error Handling: Always handle cases where WMI queries might fail (returns null)
  • Includes hardware details like motherboard manufacturer and BIOS version
  • Provides both system and Windows directory paths
  • Non-blocking operation - doesn't freeze the UI
  • Safe to call multiple times - data is gathered on each call