Created
June 16, 2026 11:35
-
-
Save ErikBjare/5e784eae9d26dd5be3a34c913efa0c13 to your computer and use it in GitHub Desktop.
extract.psh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ErrorActionPreference = "Continue" | |
| $stamp = Get-Date -Format "yyyyMMdd-HHmmss" | |
| $hostname = $env:COMPUTERNAME | |
| $out = "$env:USERPROFILE\Desktop\MS-A2-Windows-License-Dump-$hostname-$stamp" | |
| New-Item -ItemType Directory -Force -Path $out | Out-Null | |
| Start-Transcript -Path "$out\transcript.txt" | |
| Write-Host "Dumping Windows/license/SMBIOS info to: $out" | |
| # Activation / license state | |
| cscript.exe "$env:windir\system32\slmgr.vbs" /dlv > "$out\slmgr-dlv.txt" | |
| cscript.exe "$env:windir\system32\slmgr.vbs" /xpr > "$out\slmgr-xpr.txt" | |
| cscript.exe "$env:windir\system32\slmgr.vbs" /dli > "$out\slmgr-dli.txt" | |
| # Embedded OEM key from firmware, if present | |
| $oa3 = (Get-CimInstance -Query "select * from SoftwareLicensingService").OA3xOriginalProductKey | |
| $oa3 | Out-File "$out\OA3xOriginalProductKey.txt" | |
| # Windows licensing products | |
| Get-CimInstance SoftwareLicensingProduct | | |
| Where-Object { $_.Name -like "*Windows*" -or $_.PartialProductKey } | | |
| Select-Object Name, Description, LicenseStatus, PartialProductKey, ProductKeyChannel, ID, ApplicationID | | |
| Format-List | | |
| Out-File "$out\SoftwareLicensingProduct.txt" | |
| # Windows edition/build | |
| Get-ComputerInfo | | |
| Select-Object ` | |
| WindowsProductName, | |
| WindowsEditionId, | |
| WindowsVersion, | |
| WindowsBuildLabEx, | |
| OsArchitecture, | |
| OsHardwareAbstractionLayer, | |
| CsSystemType, | |
| CsManufacturer, | |
| CsModel, | |
| BiosSeralNumber, | |
| BiosBIOSVersion, | |
| BiosFirmwareType | | |
| Format-List | | |
| Out-File "$out\Windows-ComputerInfo.txt" | |
| # SMBIOS / hardware identity | |
| Get-CimInstance Win32_ComputerSystem | | |
| Select-Object Manufacturer, Model, SystemType, TotalPhysicalMemory | | |
| Format-List | | |
| Out-File "$out\SMBIOS-ComputerSystem.txt" | |
| Get-CimInstance Win32_ComputerSystemProduct | | |
| Select-Object Vendor, Name, Version, IdentifyingNumber, UUID, SKUNumber | | |
| Format-List | | |
| Out-File "$out\SMBIOS-ComputerSystemProduct.txt" | |
| Get-CimInstance Win32_BIOS | | |
| Select-Object Manufacturer, Name, Version, SMBIOSBIOSVersion, SerialNumber, ReleaseDate | | |
| Format-List | | |
| Out-File "$out\SMBIOS-BIOS.txt" | |
| Get-CimInstance Win32_BaseBoard | | |
| Select-Object Manufacturer, Product, Version, SerialNumber | | |
| Format-List | | |
| Out-File "$out\SMBIOS-BaseBoard.txt" | |
| Get-CimInstance Win32_SystemEnclosure | | |
| Select-Object Manufacturer, ChassisTypes, SerialNumber, SMBIOSAssetTag | | |
| Format-List | | |
| Out-File "$out\SMBIOS-SystemEnclosure.txt" | |
| # CPU identity | |
| Get-CimInstance Win32_Processor | | |
| Select-Object Name, Manufacturer, ProcessorId, SocketDesignation, NumberOfCores, NumberOfLogicalProcessors | | |
| Format-List | | |
| Out-File "$out\CPU.txt" | |
| # Network adapters / MAC addresses | |
| Get-CimInstance Win32_NetworkAdapter | | |
| Where-Object { $_.MACAddress } | | |
| Select-Object Name, Manufacturer, MACAddress, PNPDeviceID, NetConnectionID, PhysicalAdapter | | |
| Format-Table -AutoSize | | |
| Out-File "$out\NetworkAdapters-MACs.txt" | |
| # Disks | |
| Get-CimInstance Win32_DiskDrive | | |
| Select-Object Model, SerialNumber, FirmwareRevision, InterfaceType, Size, PNPDeviceID | | |
| Format-List | | |
| Out-File "$out\Disks.txt" | |
| # TPM info | |
| try { | |
| Get-Tpm | Format-List | Out-File "$out\TPM.txt" | |
| } catch { | |
| $_ | Out-File "$out\TPM-error.txt" | |
| } | |
| # Secure Boot state | |
| try { | |
| Confirm-SecureBootUEFI | Out-File "$out\SecureBoot.txt" | |
| } catch { | |
| $_ | Out-File "$out\SecureBoot-error.txt" | |
| } | |
| # BitLocker state, useful to know before wiping | |
| try { | |
| Get-BitLockerVolume | Format-List | Out-File "$out\BitLocker.txt" | |
| } catch { | |
| $_ | Out-File "$out\BitLocker-error.txt" | |
| } | |
| # Registry exports relevant to activation / install identity | |
| reg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" "$out\CurrentVersion.reg" /y | |
| reg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" "$out\SoftwareProtectionPlatform.reg" /y | |
| reg export "HKLM\SYSTEM\CurrentControlSet\Control\SystemInformation" "$out\SystemInformation.reg" /y | |
| # Full system reports | |
| systeminfo > "$out\systeminfo.txt" | |
| try { | |
| msinfo32 /nfo "$out\msinfo32.nfo" | |
| Start-Sleep -Seconds 10 | |
| } catch { | |
| $_ | Out-File "$out\msinfo32-error.txt" | |
| } | |
| # Human-readable summary file | |
| @" | |
| Machine: $hostname | |
| Dump time: $stamp | |
| Most important files: | |
| - OA3xOriginalProductKey.txt | |
| - slmgr-dlv.txt | |
| - slmgr-xpr.txt | |
| - SoftwareLicensingProduct.txt | |
| - Windows-ComputerInfo.txt | |
| - SMBIOS-ComputerSystemProduct.txt | |
| - SMBIOS-BIOS.txt | |
| - SMBIOS-BaseBoard.txt | |
| - NetworkAdapters-MACs.txt | |
| Possible Proxmox SMBIOS fields of interest: | |
| - manufacturer: see SMBIOS-ComputerSystem.txt / SMBIOS-BaseBoard.txt | |
| - product: see SMBIOS-ComputerSystemProduct.txt / SMBIOS-BaseBoard.txt | |
| - serial: see SMBIOS-BIOS.txt / SMBIOS-BaseBoard.txt / SMBIOS-ComputerSystemProduct.txt | |
| - uuid: see SMBIOS-ComputerSystemProduct.txt | |
| - sku: see SMBIOS-ComputerSystemProduct.txt | |
| "@ | Out-File "$out\README.txt" | |
| Stop-Transcript | |
| # Zip it | |
| $zip = "$out.zip" | |
| Compress-Archive -Path "$out\*" -DestinationPath $zip -Force | |
| Write-Host "" | |
| Write-Host "Done." | |
| Write-Host "Folder: $out" | |
| Write-Host "Zip: $zip" | |
| Write-Host "" | |
| Write-Host "Copy the ZIP off this machine before wiping it." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment