Skip to content

Instantly share code, notes, and snippets.

@csev1755
Last active January 24, 2022 16:17
Show Gist options
  • Save csev1755/3b00bac0b0fc158b3eadc50ab867c2db to your computer and use it in GitHub Desktop.
Save csev1755/3b00bac0b0fc158b3eadc50ab867c2db to your computer and use it in GitHub Desktop.
Get Windows 10 license key and output info to a file
$servicetag = Read-Host "Enter Service Tag"
$filename = "$servicetag-KEY.txt"
Get-Date | Out-File -FilePath $filename -append
(Get-WmiObject -class Win32_OperatingSystem).Caption | Out-File -FilePath $filename -append
wmic path SoftwareLicensingService get OA3xOriginalProductKey | Out-File -FilePath $filename -append
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment