If you’re working on a device that has an embedded OEM Windows product key, you can run the following to retrieve it:
wmic path SoftwareLicensingService get OA3xOriginalProductKey
“That’s nice,” you say, “but can we do that in PowerShell?”
But of course!
(Get-CimInstance -ClassName "SoftwareLicensingService").OA3xOriginalProductKey