Als u bent kwijtgeraakt of bent vergeten waar u uw Windows-productsleutel had opgeslagen, heb ik een oplossing voor u. Vandaag zullen we zien hoe een eenvoudig VBS-script kan worden gebruikt om ons de productsleutel van een geïnstalleerd exemplaar van Windows 10, Windows 8 of Windows 7 te laten zien. Het is een eenvoudige oplossing om uw productsleutel uit het besturingssysteem te halen dat op uw pc is geïnstalleerd zonder met behulp van software van derden. Daar gaan we.
Advertentie
Eerder plaatste ik een vergelijkbare oplossing die PowerShell gebruikte. maar veel gebruikers klaagden dat het voor hen niet lukte. PowerShell vereist mogelijk extra gebruikersvaardigheden en extra tweaks om niet-ondertekende cmdlets uit te voeren.
hoe een account op netflix te verwijderen
In vergelijking met PowerShell is deze VBScript-oplossing bijna perfect. Het enige dat u hoeft te doen, is op het bestand te klikken. Naar bekijk uw productcode van Windows 10
- Open Kladblok.
- Kopieer en plak de volgende tekst in het Kladblok-venster
Optie Expliciet Dim objshell, path, DigitalID, Result Set objshell = CreateObject ('WScript.Shell') 'Set registersleutelpad Path =' HKLM SOFTWARE Microsoft Windows NT CurrentVersion '' Registersleutelwaarde DigitalID = objshell.RegRead (Pad & 'DigitalProductId') Dim ProductName, ProductID, ProductKey, ProductData 'Get ProductName, ProductID, ProductKey ProductName =' Productnaam: '& objshell.RegRead (Path &' ProductName ') ProductID =' Product-ID: '& objshell. RegRead (Path & 'ProductID') ProductKey = 'Geïnstalleerde sleutel:' & ConvertToKey (DigitalID) ProductData = Productnaam & vbNewLine & ProductID & vbNewLine & ProductKey 'Toon berichtvak indien opslaan in bestand If vbYes = MsgBox (ProductData & vblf & vblf & 'Opslaan naar een bestand?', VbYesNo + vbQuestion, 'BackUp Windows Key Information') en vervolgens Save ProductData End If 'Convert binary to chars Function ConvertToKey (Key) Const KeyOffset = 52 Dim isWin8, Maps, i, j, Current, KeyOutput , Last, keypart1, insert 'Controleer of het besturingssysteem Windows 8 is isWin8 = (Key (66) 6) en 1 sleutel (66) = (Key (66) And & HF7) Of ((isWin8 And 2) * 4) i = 24 Maps = 'BCDFGHJKMPQRTVWXY2346789' Do Current = 0 j = 14 Do Current = Current * 256 Current = Key (j + KeyOffset) + Current 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 While i> = 0 If (isWin8 = 1) Then keypart1 = Mid (KeyOutput, 2, Last) insert = 'N' KeyOutput = Vervangen (KeyOutput, keypart1, keypart1 & insert, 2, 1, 0) If Last = 0 Then KeyOutput = insert & KeyOutput End If ConvertToKey = Mid (KeyOutput, 1, 5) & '-' & Mid (KeyOutput, 6, 5) & '-' & Mid (KeyOutput, 11, 5) & '-' & Mid ( KeyOutput, 16, 5) & '-' & Mid (KeyOutput, 21, 5) End Function 'Gegevens opslaan in een bestand Functie Opslaan (gegevens) Dim fso, fName, txt, objshell, UserName Set objshell = CreateObject (' wscript. shell ')' Krijg huidige gebruikersnaam UserName = objshell.ExpandEnvironmentStrings ('% UserName%') 'Maak een tekstbestand op desktop fName =' C: Users '& UserName &' Desktop WindowsKeyI nfo.txt 'Set fso = CreateObject (' Scripting.FileSystemObject ') Set txt = fso.CreateTextFile (fName) txt.Writeline Data txt.Close End Function
- Sla de bovenstaande tekst op in een bestand met de extensie '.vbs' op het bureaublad.
Bonustip: om ervoor te zorgen dat u het bestand correct opslaat met de extensie '.vbs', kunt u de naam tussen dubbele aanhalingstekens typen, bijvoorbeeld 'BackupWindowsKey.vbs'.
- Open nu uw BackupWindowsKey.vbs-bestand
- Voila, je productsleutel wordt op het scherm weergegeven!
Klik hier om het bestand BackupWindowsKey.vbs te downloaden
Ik heb deze truc getest op Windows 7, Windows 8 en Windows 10. Het werkt probleemloos in alle genoemde besturingssystemen. Credits: non-existentie @ MDL .