🧬 WQL / PowerShell

Win32_ComputerSystem: Querying Computer System Info Remotely (CIM Session)

Runs the same Win32_ComputerSystem WQL query against a remote computer over a CIM session — the modern, WinRM-based replacement for old DCOM WMI queries.

By WindowsScripting.com · 1.1 KB
ComputerSystemRemote.ps1
<#
.SYNOPSIS
    WQL reference: querying Computer System Info on a remote computer (Win32_ComputerSystem).

.DESCRIPTION
    The same WQL SELECT statement used locally works unchanged against a
    remote computer — only the connection changes. This uses a CIM
    session (WinRM-based), the modern replacement for the old DCOM-based
    -ComputerName parameter on Get-WmiObject.

.PARAMETER ComputerName
    Name or IP address of the remote computer. WinRM must be enabled
    there (Enable-PSRemoting) and you need admin rights on it.

.EXAMPLE
    .\ComputerSystemRemote.ps1 -ComputerName SERVER01
#>

[CmdletBinding()]
param(
    [Parameter(Mandatory)]
    [string]$ComputerName
)

$wqlQuery = "SELECT Name, Manufacturer, Model, TotalPhysicalMemory, NumberOfProcessors FROM Win32_ComputerSystem"
$session = New-CimSession -ComputerName $ComputerName

try {
    Get-CimInstance -CimSession $session -Query $wqlQuery | Format-Table -Property Name, Manufacturer, Model, TotalPhysicalMemory, NumberOfProcessors -AutoSize
} finally {
    Remove-CimSession -CimSession $session
}