Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #Requires -RunAsAdministrator
  2. $clientKeys = @{
  3. 'Microsoft Windows 10 Enterprise' = 'NPPR9-FWDCX-D2C8J-H872K-2YT43'
  4. 'Microsoft Windows 10 Enterprise LTSC' = 'M7XTQ-FN8P6-TTKYV-9D4CC-J462D'
  5. 'Microsoft Windows 10 Enterprise N LTSC' = '92NFX-8DJQP-P6BBQ-THF9C-7CG2H'
  6. 'Microsoft Windows 10 Pro' = 'W269N-WFGWX-YVC9B-4J6C9-T83GX'
  7. 'Microsoft Windows 7 Enterprise' = '33PXH-7Y6KF-2VJC9-XBBR8-HVTHH'
  8. 'Microsoft Windows 7 Professional' = 'FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4'
  9. 'Microsoft Windows Server 2008 R2 Standard' = 'YC6KT-GKW9T-YTKYR-T4X34-R7VHC'
  10. 'Microsoft Windows Server 2012 R2 Standard' = 'D2N9P-3P6X9-2R39C-7RTCD-MDVJX'
  11. 'Microsoft Windows Server 2016 Datacenter' = 'CB7KF-BWN84-R7R2Y-793K2-8XDDG'
  12. 'Microsoft Windows Server 2016 Standard' = 'WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY'
  13. }
  14. $osVersion = (Get-WmiObject -Class Win32_OperatingSystem).Caption
  15. $osVersion = $osVersion.Trim()
  16. if ($clientKeys.ContainsKey($osVersion)) {
  17. $kmsKey = $clientKeys[$osVersion]
  18. Set-Location c:\windows\system32
  19. cscript slmgr.vbs -ipk $kmsKey
  20. cscript slmgr.vbs -ato
  21. }else{
  22. Write-Error "No KMS client key found for $osVersion"
  23. exit 1
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement