function Get-UEFIProductKey { $keyPath = "SoftwareLicensingService" $service = Get-WmiObject -Query "SELECT * FROM $keyPath" if ($service) { $productKey = $service.PartialProductKey Write-Output "Partial Product Key: $productKey" } else { Write-Output "No product key found in UEFI/BIOS." } } Get-UEFIProductKey