Created
September 25, 2019 08:11
-
-
Save shortcord/05156029ca9d484401e084a0b4fecd82 to your computer and use it in GitHub Desktop.
Gets the OEM Windows 10 Key from UEFI.
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
$wmicOutput = ((wmic path softwarelicensingservice get OA3xOriginalProductKey) | Out-String).Replace("`n", ""); | |
$regexMatch = [regex]::Match($wmicOutput, "(?<orgKey>[a-zA-Z0-9]+-[a-zA-Z0-9]+-[a-zA-Z0-9]+-[a-zA-Z0-9]+-[a-zA-Z0-9]+)"); | |
if ($regexMatch.Success) | |
{ | |
echo "Found Key from UEFI BIOS"; | |
$key = $regexMatch.Groups["orgKey"]; | |
Set-Clipboard $key; | |
echo "$key; Copied to Clipboard."; | |
} else { | |
echo "No key found."; | |
} | |
pause; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment