Choose the tool for the question
A server upgrade needs model and RAM details; a display fault needs graphics-driver information. Those questions call for different tools. CIM provides structured model, RAM and BIOS data, systeminfo gives a quick overview, and DxDiag targets DirectX, graphics and audio drivers. This guide creates a retainable report and explains its limits: none of these tools alone establishes RAID health or a VM host's physical capacity.
Which Tool Fits the Investigation?
| Tool | Best fit | Limit |
|---|---|---|
| CMD / systeminfo | OS, CPU and RAM overview during support | Text output is awkward for structured inventory |
| PowerShell / CIM | Automated inventory and JSON exports | Accuracy depends on providers and permissions |
| DxDiag | DirectX, graphics, audio and driver investigation | Does not replace CMDB or RAID health checks |
CMD is a shell, not a hardware API. The utility it runs determines the information source. WMIC may be absent or disabled on newer Windows versions, so use CIM for new automation. Do not assume DxDiag is present on Server Core.
Modules and read access
The script targets x64 Windows PowerShell 5.1 on Windows 11 or Server 2022/2025 with CimCmdlets and Storage.
Run on the existing host with a writable report location. Compare VM provider data with hypervisor inventory.
Local reads usually work with standard privileges. Remote CIM requires authorized sessions. Do not assume DxDiag exists on Server Core.
WMIC and systems without a GUI
WMIC is deprecated and one host’s availability does not establish fleet availability. Prefer CIM for new automation. DxDiag applies to systems with its graphics components.
Providers and inventory snapshots
The script reads CIM and storage providers, then converts their data to JSON. The CMDB can compare that snapshot with the baseline. Add vendor tools for specialized GPU or RAID health information; an inventory report does not contain every hardware telemetry source.
Example: inventory before an upgrade
Compare model, BIOS, cores and RAM with CMDB, retaining collection UTC. VM serials might be virtual identifiers. Use hardware-management consoles for chassis identity.
Collect JSON and a DxDiag report
Run the following read-only inventory script on the target host in Windows PowerShell 5.1 x64. It writes its report to the user's TEMP directory. If organizational policy disallows that location, substitute an approved writable directory before running it.
$ErrorActionPreference = 'Stop'
$InventoryPath = Join-Path $env:TEMP ('Inventory-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '.json')
$Inventory = [ordered]@{
CollectedUtc = [DateTime]::UtcNow.ToString('o')
Computer = Get-CimInstance Win32_ComputerSystem | Select-Object Name,Manufacturer,Model,TotalPhysicalMemory
OS = Get-CimInstance Win32_OperatingSystem | Select-Object Caption,Version,BuildNumber,LastBootUpTime
CPU = @(Get-CimInstance Win32_Processor | Select-Object Name,NumberOfCores,NumberOfLogicalProcessors)
Memory = @(Get-CimInstance Win32_PhysicalMemory | Select-Object Manufacturer,PartNumber,Capacity,Speed)
BIOS = Get-CimInstance Win32_BIOS | Select-Object Manufacturer,SMBIOSBIOSVersion,SerialNumber
Disks = @(Get-PhysicalDisk | Select-Object FriendlyName,MediaType,Size,HealthStatus)
Video = @(Get-CimInstance Win32_VideoController | Select-Object Name,DriverVersion)
}
$Inventory | ConvertTo-Json -Depth 6 | Set-Content -LiteralPath $InventoryPath -Encoding UTF8
Get-Content -LiteralPath $InventoryPath -Raw | ConvertFrom-Json | Select-Object CollectedUtc,Computer
Get-FileHash -LiteralPath $InventoryPath -Algorithm SHA256JSON includes a UTC timestamp and named objects. Capacity and Size are bytes. Divide by PowerShell 1GB for GiB. Verify model and serial against CMDB/vendor consoles. Run DxDiag only where the GUI/binary exists and the report directory is writable.
On systems with DxDiag, these commands create and check a text report. This is separate from the inventory script and suits graphics-driver diagnostics.
$DxReport = Join-Path $env:TEMP ('DxDiag-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '.txt')
Start-Process -FilePath "$env:WINDIR\System32\dxdiag.exe" -ArgumentList @("/t", '"' + $DxReport + '"') -Wait -WindowStyle Hidden
Get-Item -LiteralPath $DxReport -ErrorAction StopReports and remote sessions
Hostnames and serials disclose organizational assets. Avoid public shares. Use least-privilege Kerberos/TLS remote CIM. Do not enable Basic without TLS to fix access denied.
Inventory differs from health checks
Inventory records installed components and capacity; a health check examines how they operate. Compare RAM or BIOS changes with approved changes. Disk HealthStatus does not expose every SMART or RAID-controller condition. Use the relevant telemetry for health and inventory for ownership and capacity.
Units and limited-precision properties
Script Capacity/Size values are bytes. Dividing by PowerShell 1GB yields GiB. Do not use AdapterRAM to size modern GPUs. Confirm through vendor tools.
Null values and RAID abstractions
Do not convert Null to zero: the provider may not expose that value. A VM may lack physical-hardware details, and Get-PhysicalDisk may show only a controller's virtual disk. Investigate remote CIM Access Denied through permissions and session setup. Missing DxDiag on Server Core is not an inventory-script failure.
Retain snapshots and recovery records
Retain JSON, hashes and timestamps according to retention. Hardware replacement also requires drivers, firmware, RAID configuration and data backups. Inventory lists assets rather than providing restoration.
Best Practices
- Version-control configuration and review changes.
- Use least privilege and explicit allow-lists.
- Automate repeatable checks and monitor the expected state.
- Test upgrades and restores before production rollout.
Conclusion
A reliable implementation of Windows Hardware Inventory with systeminfo, CIM and DxDiag is more than a successful first run. Keep the configuration documented, observable, recoverable, and aligned with the team's change-management process.
Frequently Asked Questions
Is DxDiag appropriate for every server?
No. It targets graphics/DirectX and may be absent on Server Core.
Does Healthy HealthStatus guarantee RAID health?
No. Inspect controller telemetry and vendor tools as well.