Skip to content

MSWindows Hardware info CMD

cpx November 12, 2025 4 min read MSWindows (MSFT)
# Hardware Information Report Script
# Compatible with PowerShell 2.0+ (Windows 7 and above)

$OutputFile = "hardware_info.txt"

Write-Host "========================================" -ForegroundColor Cyan
Write-Host "   HARDWARE INFORMATION REPORT" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Generating report... Please wait..." -ForegroundColor Yellow
Write-Host ""

# Start building the report
$Report = @"
========================================
   HARDWARE INFORMATION REPORT
========================================
Generated: $(Get-Date -Format "yyyy-MM-dd HH:mm:ss")

"@

# System Information
$Report += "`n[SYSTEM INFORMATION]`n`n"
$OS = Get-WmiObject -Class Win32_OperatingSystem
$CS = Get-WmiObject -Class Win32_ComputerSystem
$Report += "OS Name: $($OS.Caption)`n"
$Report += "OS Version: $($OS.Version)`n"
$Report += "OS Architecture: $($OS.OSArchitecture)`n"
$Report += "Computer Name: $($CS.Name)`n"
$Report += "Manufacturer: $($CS.Manufacturer)`n"
$Report += "Model: $($CS.Model)`n"
$Report += "System Type: $($CS.SystemType)`n"

# BIOS Information
$Report += "`n[BIOS INFORMATION]`n`n"
$BIOS = Get-WmiObject -Class Win32_BIOS
$Report += "Manufacturer: $($BIOS.Manufacturer)`n"
$Report += "Version: $($BIOS.Version)`n"
$Report += "Serial Number: $($BIOS.SerialNumber)`n"
$Report += "Release Date: $($BIOS.ReleaseDate)`n"

# CPU Information
$Report += "`n[CPU INFORMATION]`n`n"
$CPU = Get-WmiObject -Class Win32_Processor
$Report += "Name: $($CPU.Name)`n"
$Report += "Number of Cores: $($CPU.NumberOfCores)`n"
$Report += "Number of Logical Processors: $($CPU.NumberOfLogicalProcessors)`n"
$Report += "Max Clock Speed: $($CPU.MaxClockSpeed) MHz`n"
$Report += "Current Clock Speed: $($CPU.CurrentClockSpeed) MHz`n"
$Report += "Architecture: $($CPU.Architecture)`n"
$Report += "L2 Cache Size: $($CPU.L2CacheSize) KB`n"
$Report += "L3 Cache Size: $($CPU.L3CacheSize) KB`n"

# Memory Information
$Report += "`n[MEMORY INFORMATION]`n`n"
$Memory = Get-WmiObject -Class Win32_PhysicalMemory
$TotalRAM = [math]::Round($CS.TotalPhysicalMemory / 1GB, 2)
$Report += "Total Physical Memory: $TotalRAM GB`n`n"

$MemorySlot = 1
foreach ($Stick in $Memory) {
    $Capacity = [math]::Round($Stick.Capacity / 1GB, 2)
    $Report += "Memory Slot $MemorySlot:`n"
    $Report += "  Capacity: $Capacity GB`n"
    $Report += "  Speed: $($Stick.Speed) MHz`n"
    $Report += "  Manufacturer: $($Stick.Manufacturer)`n"
    $Report += "  Part Number: $($Stick.PartNumber)`n"
    $Report += "  Serial Number: $($Stick.SerialNumber)`n`n"
    $MemorySlot++
}

# Disk Information
$Report += "`n[DISK INFORMATION]`n`n"
$Disks = Get-WmiObject -Class Win32_DiskDrive
$DiskNum = 1
foreach ($Disk in $Disks) {
    $Size = [math]::Round($Disk.Size / 1GB, 2)
    $Report += "Disk $DiskNum`:`n"
    $Report += "  Model: $($Disk.Model)`n"
    $Report += "  Size: $Size GB`n"
    $Report += "  Interface: $($Disk.InterfaceType)`n"
    $Report += "  Serial Number: $($Disk.SerialNumber)`n"
    $Report += "  Partitions: $($Disk.Partitions)`n`n"
    $DiskNum++
}

# Logical Drives
$Report += "`n[LOGICAL DRIVES]`n`n"
$LogicalDisks = Get-WmiObject -Class Win32_LogicalDisk | Where-Object { $_.DriveType -eq 3 }
foreach ($LD in $LogicalDisks) {
    $Size = [math]::Round($LD.Size / 1GB, 2)
    $FreeSpace = [math]::Round($LD.FreeSpace / 1GB, 2)
    $UsedSpace = $Size - $FreeSpace
    $PercentFree = [math]::Round(($FreeSpace / $Size) * 100, 2)
    $Report += "Drive $($LD.DeviceID)`n"
    $Report += "  Volume Name: $($LD.VolumeName)`n"
    $Report += "  File System: $($LD.FileSystem)`n"
    $Report += "  Total Size: $Size GB`n"
    $Report += "  Used Space: $UsedSpace GB`n"
    $Report += "  Free Space: $FreeSpace GB ($PercentFree%)`n`n"
}

# Motherboard Information
$Report += "`n[MOTHERBOARD INFORMATION]`n`n"
$Motherboard = Get-WmiObject -Class Win32_BaseBoard
$Report += "Manufacturer: $($Motherboard.Manufacturer)`n"
$Report += "Product: $($Motherboard.Product)`n"
$Report += "Version: $($Motherboard.Version)`n"
$Report += "Serial Number: $($Motherboard.SerialNumber)`n"

# Graphics Card Information
$Report += "`n[GRAPHICS CARD INFORMATION]`n`n"
$GPU = Get-WmiObject -Class Win32_VideoController
$GPUNum = 1
foreach ($Card in $GPU) {
    $VRAM = [math]::Round($Card.AdapterRAM / 1GB, 2)
    $Report += "GPU $GPUNum`:`n"
    $Report += "  Name: $($Card.Name)`n"
    $Report += "  Video Memory: $VRAM GB`n"
    $Report += "  Driver Version: $($Card.DriverVersion)`n"
    $Report += "  Driver Date: $($Card.DriverDate)`n"
    $Report += "  Video Processor: $($Card.VideoProcessor)`n"
    $Report += "  Current Resolution: $($Card.CurrentHorizontalResolution) x $($Card.CurrentVerticalResolution)`n"
    $Report += "  Current Refresh Rate: $($Card.CurrentRefreshRate) Hz`n`n"
    $GPUNum++
}

# Network Adapters
$Report += "`n[NETWORK ADAPTERS]`n`n"
$Network = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object { $_.PhysicalAdapter -eq $true -and $_.MACAddress -ne $null }
$NetNum = 1
foreach ($Adapter in $Network) {
    $Report += "Adapter $NetNum`:`n"
    $Report += "  Name: $($Adapter.Name)`n"
    $Report += "  MAC Address: $($Adapter.MACAddress)`n"
    $Report += "  Speed: $($Adapter.Speed)`n"
    $Report += "  Status: $($Adapter.NetConnectionStatus)`n`n"
    $NetNum++
}

# Network Configuration
$Report += "`n[NETWORK CONFIGURATION]`n`n"
$NetConfig = Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Where-Object { $_.IPEnabled -eq $true }
foreach ($Config in $NetConfig) {
    $Report += "Interface: $($Config.Description)`n"
    $Report += "  IP Address: $($Config.IPAddress -join ', ')`n"
    $Report += "  Subnet Mask: $($Config.IPSubnet -join ', ')`n"
    $Report += "  Default Gateway: $($Config.DefaultIPGateway -join ', ')`n"
    $Report += "  DNS Servers: $($Config.DNSServerSearchOrder -join ', ')`n"
    $Report += "  DHCP Enabled: $($Config.DHCPEnabled)`n`n"
}

# Battery Information (for laptops)
$Battery = Get-WmiObject -Class Win32_Battery
if ($Battery) {
    $Report += "`n[BATTERY INFORMATION]`n`n"
    $Report += "Name: $($Battery.Name)`n"
    $Report += "Status: $($Battery.Status)`n"
    $Report += "Estimated Charge Remaining: $($Battery.EstimatedChargeRemaining)%`n"
    $Report += "Battery Status: $($Battery.BatteryStatus)`n"
}

# Save report to file
$Report | Out-File -FilePath $OutputFile -Encoding UTF8

Write-Host "========================================" -ForegroundColor Green
Write-Host "Report generated successfully!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "Output saved to: $OutputFile" -ForegroundColor Yellow
Write-Host ""
Write-Host "Opening report..." -ForegroundColor Yellow

# Open the report
notepad $OutputFile
0 0 votes
Article Rating
guest

0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x