Skip to content

Instantly share code, notes, and snippets.

@shortcord
Created September 25, 2019 08:11
Show Gist options
  • Save shortcord/05156029ca9d484401e084a0b4fecd82 to your computer and use it in GitHub Desktop.
Save shortcord/05156029ca9d484401e084a0b4fecd82 to your computer and use it in GitHub Desktop.
Gets the OEM Windows 10 Key from UEFI.
$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