Comment afficher votre clé de produit Windows 10 à l'aide d'un script

2019-09-25 18:27:05
Principal·Microsoft·Comment afficher votre clé de produit Windows 10 à l'aide d'un script

Il existe de nombreux outils pour extraire la clé de produit d'un système actif ou de la ruche de registre d'un ordinateur hors ligne. De plus, voici un petit Vbscript soigné qui obtient la clé de produit de votre installation actuelle de Windows - aucun programme tiers requis. Le script fonctionne sur Windows 7, 8 et Windows 10.

Afficher la clé de produit Windows 10 à l'aide d'un script

Copiez le code suivant dans le bloc-notes et enregistrez le fichier sous GetProductKey.vbs.

 Option Explicit Dim objshell, path, DigitalID, Result Set objshell = CreateObject ("WScript.Shell") 'Définir le chemin de la clé de registre Path = "HKLM \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \"' Valeur de clé de registre DigitalID = objshell.RegRead (Path & "DigitalProductId") Dim ProductName, ProductID, ProductKey, ProductData 'Get ProductName, ProductID, ProductKey ProductName = "Product Name:" & objshell.RegRead (Path & "ProductName") ProductID = "ID produit:" & objshell. RegRead (Path & "ProductID") ProductKey = "Installed Key:" & ConvertToKey (DigitalID) ProductData = ProductName & vbNewLine & ProductID & vbNewLine & ProductKey "Afficher la boîte de messagerie si enregistrer dans un fichier Si vbYes = MsgBox (ProductData & vblf & vblf & "Enregistrer dans un fichier?", VbYesNo + vbQuestion, "Sauvegarder les informations de clé Windows") puis enregistrer ProductData End If 'Convert binary to chars Function ConvertToKey (Key) Const KeyOffset = 52 Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert 'Check if OS is Windows 8 isWin8 = (Key (66) \ 6) And 1 Key (66) = (Clé (66) et & HF7) ou ((isWin8 et 2) * 4) i = 24 cartes = "BCDFGHJKMPQRTVWXY2346789" courant actuel = 0 j = 14 courant actuel = courant * 256 courant = clé (j + décalage de clé) + courant Key (j + KeyOffset) = (Current \ 24) Current = Current Mod 24 j = j -1 Loop While j> = 0 i = i -1 KeyOutput = Mid (Maps, Current + 1, 1) & KeyOutput Last = Current Loop Alors que i> = 0 Si (isWin8 = 1) Alors keypart1 = Mid (KeyOutput, 2, Last) insert = "N" KeyOutput = Replace (KeyOutput, keypart1, keypart1 & insert, 2, 1, 0) If Last = 0 Then KeyOutput = insérer & KeyOutput End Si ConvertToKey = Mid (KeyOutput, 1, 5) & "-" & Mid (KeyOutput, 6, 5) & "-" & Mid (KeyOutput, 11, 5) & "-" & Mid ( KeyOutput, 16, 5) & "-" & Mid (KeyOutput, 21, 5) End Function 'Save data to a file Function Save (Data) Dim fso, fName, txt, objshell, UserName Set objshell = CreateObject ("wscript. shell ") 'Obtenir le nom d'utilisateur actuel UserName = objshell.ExpandEnvironmentStrings ("% UserName% ")' Créer un fichier texte sur le bureau fName =" C: \ Users \ "& UserName &" \ Desktop \ WindowsKeyInf o.txt "Set fso = CreateObject (" Scripting.FileSystemObject ") Set txt = fso.CreateTextFile (fName) txt.Writeline Data txt.Close End Function 

Source: Récupérer la clé de produit Windows · GitHub

Double-cliquez pour exécuter le script pour connaître la clé de produit de votre installation Windows.

Choix De L'Éditeur