Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. $wmicOutput = ((wmic path softwarelicensingservice get OA3xOriginalProductKey) | Out-String).Replace("`n", "");
  2.  
  3. $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]+)");
  4.  
  5. if ($regexMatch.Success)
  6. {
  7. echo "Found Key from UEFI BIOS";
  8. $key = $regexMatch.Groups["orgKey"];
  9. Set-Clipboard $key;
  10. echo "$key; Copied to Clipboard.";
  11. } else {
  12. echo "No key found.";
  13. }
  14. pause;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement