# PCS Toolkit - Windows Product Key Finder # Extracts Windows product key from BIOS and Registry $timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss" $outputFile = "$env:USERPROFILE\Desktop\WindowsKey_$timestamp.txt" function Log($msg) { Write-Host $msg Add-Content $outputFile $msg } Log "========================================" Log " PCS Toolkit - Windows Key Finder" Log "========================================" Log "Generated: $(Get-Date)" Log "Computer: $env:COMPUTERNAME" Log "" Log "=== WINDOWS VERSION ===" $os = Get-CimInstance Win32_OperatingSystem Log "OS: $($os.Caption)" Log "Version: $($os.Version)" Log "Build: $($os.BuildNumber)" Log "" Log "=== OEM KEY (BIOS/UEFI) ===" try { $oemKey = (Get-CimInstance -Query "SELECT * FROM SoftwareLicensingService").OA3xOriginalProductKey if ($oemKey) { Log "OEM Product Key: $oemKey" } else { Log "No OEM key found in BIOS/UEFI" } } catch { Log "Could not retrieve OEM key" } Log "" Log "=== INSTALLED PRODUCT KEY ===" try { $partialKey = (Get-CimInstance -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND Name LIKE 'Windows%'").PartialProductKey if ($partialKey) { Log "Partial Product Key: XXXXX-XXXXX-XXXXX-XXXXX-$partialKey" } else { Log "No installed product key found" } } catch { Log "Could not retrieve installed product key" } Log "" Log "=== LICENSE STATUS ===" $slmgr = cscript //nologo $env:SystemRoot\System32\slmgr.vbs /dli 2>&1 $slmgrText = $slmgr -join [Environment]::NewLine Log $slmgrText Log "" Log "========================================" Log "KEY EXTRACTION COMPLETE" Log "========================================" explorer.exe "/select,$outputFile" Read-Host "Press Enter to exit"