How to Collect Complete PC Details and USB Device History on Windows

Two ready-to-use batch scripts that create a full hardware report of your computer and a list of every USB storage device ever connected to it. No software installation needed: just copy, save and double-click.

Before you start: works on Windows 10 and 11. Run the scripts only on computers you own or are authorised to audit. Reports are saved on your Desktop. For the most complete results, right-click the file and choose Run as administrator.

Script 1: Complete PC Details Collector

Description: Gathers 25+ sections of information in one text report: computer model, serial number, BIOS, motherboard, processor, each RAM module, disks and health, graphics card, monitors, Windows version and activation status, network adapters, IP configuration, battery health, TPM, Secure Boot, printers, antivirus and connected USB devices. It also creates a battery HTML report. No passwords or full product keys are collected.

Steps

  1. Open Notepad on your computer.
  2. Click Copy Code below and paste it into Notepad (or use Download .bat and skip to step 5).
  3. Click File → Save As. Set Save as type to All Files.
  4. Name it pcdetails.bat and click Save.
  5. Right-click the file and select Run as administrator (or just double-click).
  6. Wait for the message PC DETAILS COLLECTION COMPLETED.
  7. The report opens in Notepad automatically and is saved on your Desktop as PC_Full_Details_<ComputerName>.txt, together with Battery_Report_<ComputerName>.html on laptops.
<# :
@echo off
setlocal EnableDelayedExpansion
title Complete PC Details Collector
color 0B
cls
echo ========================================================
echo        COMPLETE PC DETAILS COLLECTOR - WINDOWS 10/11
echo ========================================================
echo.
echo Initializing diagnostic audit...
echo Please wait while 25+ hardware and system metrics are collected.
echo.

set "SCRIPT_PATH=%~f0"
for /f "tokens=1 delims=:" %%n in ('findstr /n "^#<POWERSHELL>" "%SCRIPT_PATH%"') do set /a PS_LINE=%%n

powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$lines = Get-Content -LiteralPath '%SCRIPT_PATH%';" ^
  "$code = ($lines[(%PS_LINE%)..($lines.Count - 1)]) -join [Environment]::NewLine;" ^
  "Invoke-Expression $code;"

echo.
echo ========================================================
echo             PC DETAILS COLLECTION COMPLETED
echo ========================================================
echo.
echo Report files generated on your Desktop:
echo   - PC_Full_Details_%COMPUTERNAME%.txt
if exist "%USERPROFILE%\Desktop\Battery_Report_%COMPUTERNAME%.html" (
    echo   - Battery_Report_%COMPUTERNAME%.html
)
echo.
echo Press any key to open the text report and exit...
pause >nul
start notepad.exe "%USERPROFILE%\Desktop\PC_Full_Details_%COMPUTERNAME%.txt"
exit /b
#>
#<POWERSHELL>
$computer = $env:COMPUTERNAME
$desktop = [Environment]::GetFolderPath("Desktop")
$reportTxt = Join-Path $desktop "PC_Full_Details_$computer.txt"
$reportBat = Join-Path $desktop "Battery_Report_$computer.html"

# Run battery report if laptop has a battery
try {
    $hasBattery = Get-CimInstance Win32_Battery -ErrorAction SilentlyContinue
    if ($hasBattery) {
        powercfg /batteryreport /output "$reportBat" | Out-Null
    }
} catch {}

$sb = [System.Text.StringBuilder]::new()
function Add-Section([string]$title, [string]$body) {
    [void]$sb.AppendLine("================================================================================")
    [void]$sb.AppendLine("  $title")
    [void]$sb.AppendLine("================================================================================")
    [void]$sb.AppendLine($body)
    [void]$sb.AppendLine("")
}

Write-Host "  [1/10] Querying Operating System & Hardware Enclosure..." -ForegroundColor Cyan
$os = Get-CimInstance Win32_OperatingSystem
$cs = Get-CimInstance Win32_ComputerSystem
$bb = Get-CimInstance Win32_BaseBoard
$bios = Get-CimInstance Win32_BIOS

$sec1 = @"
Computer Name        : $computer
User / Domain        : $($env:USERDOMAIN)\$($env:USERNAME)
OS Name              : $($os.Caption)
OS Version / Build   : $($os.Version) (Build $($os.BuildNumber))
Architecture         : $($os.OSArchitecture)
Install Date         : $($os.InstallDate)
Last Boot Time       : $($os.LastBootUpTime)
System Manufacturer  : $($cs.Manufacturer)
System Model         : $($cs.Model)
System SKU / Family  : $($cs.SystemSKUNumber)
Motherboard Vendor   : $($bb.Manufacturer)
Motherboard Product  : $($bb.Product)
Motherboard Serial   : $($bb.SerialNumber)
BIOS Vendor          : $($bios.Manufacturer)
BIOS Version         : $($bios.SMBIOSBIOSVersion)
BIOS Release Date    : $($bios.ReleaseDate)
Serial Number        : $($bios.SerialNumber)
"@
Add-Section "1. SYSTEM, OS & MOTHERBOARD SPECIFICATIONS" $sec1

Write-Host "  [2/10] Querying Processor & RAM Modules..." -ForegroundColor Cyan
$cpus = Get-CimInstance Win32_Processor
$cpuInfo = $cpus | ForEach-Object {
    "$($_.Name) | Cores: $($_.NumberOfCores), Logical: $($_.NumberOfLogicalProcessors), Max Clock: $($_.MaxClockSpeed) MHz"
} | Out-String

$rams = Get-CimInstance Win32_PhysicalMemory
$totalRamGB = [math]::Round(($rams | Measure-Object -Property Capacity -Sum).Sum / 1GB, 2)
$ramDetails = $rams | ForEach-Object {
    $capGB = [math]::Round($_.Capacity / 1GB, 2)
    "Slot: $($_.DeviceLocator) | Capacity: $capGB GB | Speed: $($_.Speed) MHz | Manufacturer: $($_.Manufacturer) | Part: $($_.PartNumber.Trim())"
} | Out-String

Add-Section "2. PROCESSOR (CPU) & MEMORY (RAM)" @"
Total Physical RAM   : $totalRamGB GB
Installed Processors:
$($cpuInfo.Trim())

Installed Memory Modules:
$($ramDetails.Trim())
"@

Write-Host "  [3/10] Querying Storage Disks & Partitions..." -ForegroundColor Cyan
$disks = Get-CimInstance Win32_DiskDrive
$diskDetails = $disks | ForEach-Object {
    $szGB = [math]::Round($_.Size / 1GB, 2)
    "Disk $($_.Index): $($_.Model) | Size: $szGB GB | Interface: $($_.InterfaceType) | Status: $($_.Status) | Serial: $($_.SerialNumber.Trim())"
} | Out-String

$vols = Get-CimInstance Win32_LogicalDisk | Where-Object { $_.DriveType -eq 3 }
$volDetails = $vols | ForEach-Object {
    $freeGB = [math]::Round($_.FreeSpace / 1GB, 2)
    $totGB  = [math]::Round($_.Size / 1GB, 2)
    "Drive $($_.DeviceID) [$($_.VolumeName)] | Total: $totGB GB | Free: $freeGB GB | FileSystem: $($_.FileSystem)"
} | Out-String

Add-Section "3. PHYSICAL STORAGE & LOGICAL PARTITIONS" @"
Physical Disks:
$($diskDetails.Trim())

Logical Partitions:
$($volDetails.Trim())
"@

Write-Host "  [4/10] Querying Graphics, Video & Displays..." -ForegroundColor Cyan
$gpus = Get-CimInstance Win32_VideoController
$gpuDetails = $gpus | ForEach-Object {
    "GPU: $($_.Name) | Resolution: $($_.CurrentHorizontalResolution)x$($_.CurrentVerticalResolution) @ $($_.CurrentRefreshRate)Hz | Driver: $($_.DriverVersion)"
} | Out-String
Add-Section "4. GRAPHICS ADAPTERS & DISPLAYS" $gpuDetails.Trim()

Write-Host "  [5/10] Querying Network Interfaces & IP Configuration..." -ForegroundColor Cyan
$nics = Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object { $_.IPEnabled -eq $true }
$nicDetails = $nics | ForEach-Object {
    $ipv4 = ($_.IPAddress | Where-Object { $_ -match '^\d+\.\d+\.\d+\.\d+$' }) -join ', '
    "Adapter: $($_.Description)`n  IPv4: $ipv4`n  Subnet: $($_.IPSubnet[0])`n  Gateway: $($_.DefaultIPGateway -join ', ')`n  MAC: $($_.MACAddress)`n  DHCP Enabled: $($_.DHCPEnabled)"
} | Out-String
Add-Section "5. NETWORK ADAPTERS & IP CONFIGURATION" $nicDetails.Trim()

Write-Host "  [6/10] Querying Battery, Power & Energy Metrics..." -ForegroundColor Cyan
if ($hasBattery) {
    $bat = $hasBattery | Select-Object -First 1
    $batDetails = @"
Battery Status       : Available
Estimated Charge     : $($bat.EstimatedChargeRemaining)%
Battery Health Report: Saved to Desktop ($reportBat)
"@
} else {
    $batDetails = "Battery Status       : Desktop PC / No Battery Installed"
}
Add-Section "6. BATTERY & POWER METRICS" $batDetails

Write-Host "  [7/10] Querying TPM & Secure Boot Security..." -ForegroundColor Cyan
try {
    $tpm = Get-CimInstance -Namespace "root\CIMv2\Security\MicrosoftTpm" -ClassName Win32_Tpm -ErrorAction SilentlyContinue
    $tpmStatus = if ($tpm) { "Present: Yes | Enabled: $($tpm.IsEnabled_InitialValue) | Spec: $($tpm.SpecVersion)" } else { "TPM Not Detected / Not Available" }
} catch { $tpmStatus = "Unable to query TPM (Administrator rights required)" }

try {
    $secureBoot = Confirm-SecureBootUEFI -ErrorAction SilentlyContinue
    $sbStatus = if ($secureBoot -eq $true) { "Secure Boot: Enabled (UEFI)" } elseif ($secureBoot -eq $false) { "Secure Boot: Disabled" } else { "Secure Boot: Unsupported or Legacy BIOS" }
} catch { $sbStatus = "Secure Boot: Not available or Legacy BIOS mode" }

Add-Section "7. TPM & SECURE BOOT INTEGRITY" @"
$tpmStatus
$sbStatus
"@

Write-Host "  [8/10] Querying Windows Defender & Antivirus Products..." -ForegroundColor Cyan
try {
    $avs = Get-CimInstance -Namespace "root\SecurityCenter2" -ClassName AntiVirusProduct -ErrorAction SilentlyContinue
    $avDetails = if ($avs) {
        ($avs | ForEach-Object { "Antivirus: $($_.displayName) | State: $($_.productState)" }) -join "`n"
    } else { "Windows Defender active or standard security center." }
} catch { $avDetails = "Windows Defender / Security status check restricted." }
Add-Section "8. ANTIVIRUS & SECURITY PROTECTION" $avDetails

Write-Host "  [9/10] Querying Installed Printers..." -ForegroundColor Cyan
$printers = Get-CimInstance Win32_Printer
$printerDetails = if ($printers) {
    ($printers | ForEach-Object { "Printer: $($_.Name) | Default: $($_.Default) | Port: $($_.PortName) | Status: $($_.PrinterStatus)" }) -join "`n"
} else { "No printers configured." }
Add-Section "9. PRINTERS & IMAGING DEVICES" $printerDetails

Write-Host "  [10/10] Querying Connected USB Hardware..." -ForegroundColor Cyan
$usbs = Get-CimInstance Win32_PnPEntity | Where-Object { $_.PNPClass -eq "USB" -or $_.Service -eq "USBSTOR" }
$usbDetails = if ($usbs) {
    ($usbs | ForEach-Object { "Device: $($_.Name) | Status: $($_.Status) | Hardware ID: $($_.DeviceID)" }) -join "`n"
} else { "No external USB devices detected." }
Add-Section "10. CURRENTLY CONNECTED USB HARDWARE" $usbDetails

[System.IO.File]::WriteAllText($reportTxt, $sb.ToString(), [System.Text.Encoding]::UTF8)
Write-Host "Diagnosis complete! Saved to: $reportTxt" -ForegroundColor Green

Script 2: USB Device History Collector

Description: Reads the Windows registry and lists every USB storage device (pen drive, external hard disk) that was ever connected to the PC, even if it is unplugged now. For each device it shows model, capacity (only if currently connected), brand, serial number and USB VID/PID model identifier.

Steps

  1. Open Notepad.
  2. Click Copy Code below and paste it into Notepad (or use Download .bat and skip to step 5).
  3. Click File → Save As and set Save as type to All Files.
  4. Name it USB_Device_History_Collector.bat and click Save.
  5. Right-click the file and choose Run as administrator.
  6. When it finishes, open USB_Storage_History.txt on your Desktop.
<# :
@echo off
setlocal EnableDelayedExpansion
title USB Device History Collector
color 0A
cls
echo ========================================================
echo        USB DEVICE HISTORY FORENSICS COLLECTOR
echo ========================================================
echo.
echo Scanning Windows Registry for every connected USB storage device...
echo.

set "SCRIPT_PATH=%~f0"
for /f "tokens=1 delims=:" %%n in ('findstr /n "^#<POWERSHELL>" "%SCRIPT_PATH%"') do set /a PS_LINE=%%n

powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$lines = Get-Content -LiteralPath '%SCRIPT_PATH%';" ^
  "$code = ($lines[(%PS_LINE%)..($lines.Count - 1)]) -join [Environment]::NewLine;" ^
  "Invoke-Expression $code;"

echo.
echo ========================================================
echo         USB STORAGE HISTORY COLLECTION COMPLETED
echo ========================================================
echo.
echo Report generated on your Desktop:
echo   - USB_Storage_History.txt
echo.
echo Press any key to open the text report and exit...
pause >nul
start notepad.exe "%USERPROFILE%\Desktop\USB_Storage_History.txt"
exit /b
#>
#<POWERSHELL>
$desktop = [Environment]::GetFolderPath("Desktop")
$reportFile = Join-Path $desktop "USB_Storage_History.txt"

$sb = [System.Text.StringBuilder]::new()
[void]$sb.AppendLine("================================================================================")
[void]$sb.AppendLine("                 USB STORAGE DEVICE FORENSIC HISTORY")
[void]$sb.AppendLine("                 Generated on: $(Get-Date -Format 'F')")
[void]$sb.AppendLine("                 Computer: $env:COMPUTERNAME | User: $env:USERNAME")
[void]$sb.AppendLine("================================================================================")
[void]$sb.AppendLine("")
[void]$sb.AppendLine("This report queries HKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR and enumerates")
[void]$sb.AppendLine("every USB flash drive, external HDD/SSD, and mass storage unit ever mounted.")
[void]$sb.AppendLine("--------------------------------------------------------------------------------")
[void]$sb.AppendLine("")

$regPath = "HKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR"

if (Test-Path $regPath) {
    $deviceKeys = Get-ChildItem -Path $regPath -ErrorAction SilentlyContinue
    $count = 0

    foreach ($dev in $deviceKeys) {
        $devName = $dev.PSChildName
        $instances = Get-ChildItem -Path $dev.PSPath -ErrorAction SilentlyContinue

        foreach ($inst in $instances) {
            $count++
            $serial = $inst.PSChildName
            $props = Get-ItemProperty -Path $inst.PSPath -ErrorAction SilentlyContinue
            $friendly = $props.FriendlyName
            if (-not $friendly) { $friendly = $props.DeviceDesc }
            if (-not $friendly) { $friendly = "Standard USB Mass Storage Device" }

            $hardwareId = ($props.HardwareID -join ", ")
            $mfg = $props.Mfg
            if (-not $mfg) { $mfg = "Generic / Standard USB" }

            # Parse VID and PID if present
            $vid = if ($hardwareId -match 'VID_([0-9A-Fa-f]{4})') { $matches[1] } else { "N/A" }
            $pid = if ($hardwareId -match 'PID_([0-9A-Fa-f]{4})') { $matches[1] } else { "N/A" }

            [void]$sb.AppendLine("[$count] Device: $friendly")
            [void]$sb.AppendLine("    Model Identifier : $devName")
            [void]$sb.AppendLine("    Manufacturer     : $mfg")
            [void]$sb.AppendLine("    Serial / ID      : $serial")
            [void]$sb.AppendLine("    USB Vendor ID    : VID_$vid")
            [void]$sb.AppendLine("    USB Product ID   : PID_$pid")
            [void]$sb.AppendLine("    Hardware IDs     : $hardwareId")
            [void]$sb.AppendLine("    Registry Hive    : $($inst.Name)")
            [void]$sb.AppendLine("--------------------------------------------------------------------------------")
        }
    }

    [void]$sb.AppendLine("")
    [void]$sb.AppendLine("Total Historical USB Storage Devices Identified: $count")
} else {
    [void]$sb.AppendLine("No USBSTOR registry key found. No USB mass storage history recorded.")
}

[System.IO.File]::WriteAllText($reportFile, $sb.ToString(), [System.Text.Encoding]::UTF8)
Write-Host "USB history report successfully generated at: $reportFile" -ForegroundColor Green

Important Notes

  • Do not edit or remove the line #<POWERSHELL>. The batch part uses it to find the PowerShell code below it.
  • If Windows SmartScreen or your antivirus warns about the file, choose More info → Run anyway only if you saved the code from this page yourself.
  • Some fields may be blank because manufacturers do not expose them. A blank serial number is not a hardware problem.
  • Reports contain serial numbers and MAC addresses. Share them carefully.
  • Both scripts only read information and make no changes to your system.
A

About Anjan Pandit

Senior Full-Stack Architect & MIS Specialist. Experienced in architecting Gates Foundation SCALE project M&E frameworks, AppSheet offline-first mobile systems, and enterprise PHP platforms.

Reader Reviews & Discussion

Share your thoughts, ask technical questions, or rate this article.

✍️ Write a Review
5.0
★★★★★
Based on 3 reviews
5 ★
3
4 ★
0
3 ★
0
2 ★
0
1 ★
0
A
Ankit Verma
Nov 5, 2026 at 12:11 PM
★★★★★ 5.0

Downloaded the .bat files and ran as admin. Everything worked out of the box on Windows 11 23H2.

D
David Miller
Nov 4, 2026 at 6:11 PM
★★★★★ 5.0

Clean hybrid Batch+PowerShell implementation. The battery wear level and USB history extraction are spot on.

R
Rajesh Sharma
Nov 3, 2026 at 6:11 PM
★★★★★ 5.0

The 1-click batch script for PC details saved me hours across our 40-workstation audit. Fantastic utility!

Leave a Comment & Rating

Your email address will not be published. Required fields are marked *

★ ★ ★ ★ ★
5 Stars (Outstanding)

Related Architecture & System Articles

M&E Systems & Data Modeling

Architecting High-Throughput M&E Frameworks for Multi-Tier Development Programs

Aug 30, 2026 • 6 min read
Low-Code & Automation

Offline-First Field Data Collection: Engineering Resilient Systems with Google AppSheet

Aug 17, 2026 • 5 min read
Security & Compliance

Complying with India's DPDP Act 2023 in Custom Web & CMS Architectures

Aug 2, 2026 • 7 min read
← Back to All Articles