Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
informatique:se:ms-windows:les_clefs_de_produits_microsoft [2020/04/17 17:55] – ↷ Page déplacée de informatique:se:linux:se:ms-windows:les_clefs_de_produits_microsoft à informatique:se:ms-windows:les_clefs_de_produits_microsoft jside | informatique:se:ms-windows:les_clefs_de_produits_microsoft [2020/04/17 20:06] (Version actuelle) – ↷ Page déplacée de loisirs:podcasts:informatique:se:ms-windows:les_clefs_de_produits_microsoft à informatique:se:ms-windows:les_clefs_de_produits_microsoft jside | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Récupérer la clé produit Microsoft Windows ====== | ||
+ | Un petit script permet de récupérer les informations concernant votre licence. | ||
+ | |||
+ | Copier ce code dans un fichier **viewpk.wsf**. L' | ||
+ | |||
+ | <code VBS viewpk.wsf> | ||
+ | <job> | ||
+ | < | ||
+ | < | ||
+ | --------------------------------------------------------------------- | ||
+ | Ce script en ligne de commande détermine, à partir des clefs | ||
+ | " | ||
+ | (clef de produit) sous la forme 5x5 : | ||
+ | | ||
+ | Chaque caractère fait partie de l' | ||
+ | Par défaut il examine le " | ||
+ | capable de trouver et analyser ces clefs pour tous les produits Microsoft. | ||
+ | (Office, FrontPage, Visio, ...) | ||
+ | Ce script affiche aussi la " | ||
+ | exprimée en hexadécimal, | ||
+ | Inversement, | ||
+ | |||
+ | Enfin il sert à calculer (partiellement) le ProductID à partir | ||
+ | de la ProductKey ou de la RAWkey. | ||
+ | |||
+ | JCB © 2005 | ||
+ | --------------------------------------------------------------------- | ||
+ | </ | ||
+ | <named name = " | ||
+ | helpstring = "Nom NetBIOS d' | ||
+ | Si ce paramètre est absent, on retient l' | ||
+ | type = " | ||
+ | many=" | ||
+ | required = " | ||
+ | <named | ||
+ | name = " | ||
+ | helpstring = " | ||
+ | R : clef de la branche HKLM de la base de registres (software\...) | ||
+ | (valeur par défaut) | ||
+ | T : Recherche de toutes les clefs ' | ||
+ | P : ProductKey | ||
+ | HL : chaine hexadécimale de ProductKey (RAW key) | ||
+ | en notation Little Endian (octets de poids faibles en 1ers) | ||
+ | HB : chaine hexadécimale de ProductKey (RAW key) | ||
+ | en notation Big Endian (octets de poids forts en 1ers)" | ||
+ | type = " | ||
+ | required = " | ||
+ | <unnamed name = " | ||
+ | helpstring = " | ||
+ | - clef de la branche HKLM | ||
+ | NB: ne pas indiquer ni le préfixe (HKLM) | ||
+ | ni le nom de l' | ||
+ | (à encadrer par des guillemets si le nom contient des espaces) | ||
+ | Si ce paramètre est absent, on retient la clef : | ||
+ | \SOFTWARE\Microsoft\Windows NT\CurrentVersion | ||
+ | - ProductKey sous la forme xxxxx-xxxxx-xxxxx-xxxxx-xxxxx | ||
+ | - chaine hexadécimale (RAW Key)" | ||
+ | type = " | ||
+ | many=" | ||
+ | required = " | ||
+ | < | ||
+ | Exemples : | ||
+ | ---------- | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | Dans tous les cas, il est affiché : | ||
+ | - la RAWKey en notation Little Endian | ||
+ | - la RAWKey en notation Big Endian | ||
+ | - les 2 nombres centraux du productID | ||
+ | | ||
+ | --------------------------------------------------------------------- | ||
+ | </ | ||
+ | </ | ||
+ | <script language=" | ||
+ | |||
+ | const HKEY_LOCAL_MACHINE | ||
+ | CharSet24 = array(" | ||
+ | ' | ||
+ | ' | ||
+ | Prefix=" | ||
+ | KeyDef=" | ||
+ | Entry1=" | ||
+ | Entry2=" | ||
+ | Entry3=" | ||
+ | SW_SHOWNORMAL=1 | ||
+ | Dim shell, fso, net, args, Buffer, PK(25), | ||
+ | Set shell = WScript.CreateObject(" | ||
+ | Set net = Wscript.CreateObject(" | ||
+ | Set args = Wscript.Arguments | ||
+ | Set fso = WScript.CreateObject(" | ||
+ | nbargs=args.count | ||
+ | TestHost false | ||
+ | |||
+ | Set Named = WScript.Arguments.Named | ||
+ | Set UnNamed = WScript.Arguments.UnNamed | ||
+ | nu=UnNamed.count | ||
+ | If named.Exists(" | ||
+ | Set oReg=GetObject(" | ||
+ | On Error Resume Next | ||
+ | job=" | ||
+ | If named.Exists(" | ||
+ | Select Case job | ||
+ | ' | ||
+ | Case " | ||
+ | BDR=true | ||
+ | If nu=0 Then Key=KeyDef else Key=UnNamed(0) | ||
+ | coderet=oReg.GetBinaryValue(HKEY_LOCAL_MACHINE, | ||
+ | If CodeRet<> | ||
+ | Wscript.echo " | ||
+ | Wscript.quit | ||
+ | End If | ||
+ | For index = 0 to 14 | ||
+ | PK(index)=Buffer(index+& | ||
+ | Next | ||
+ | PrintResult | ||
+ | ' | ||
+ | Case " | ||
+ | On error goto 0 | ||
+ | BDR=true | ||
+ | rep=shell.Popup(" | ||
+ | 3, "Clefs de produits Microsoft sur " & Computer, | ||
+ | If rep=2 Then Wscript.quit | ||
+ | ExploreKey(" | ||
+ | ' | ||
+ | Case " | ||
+ | BDR=false | ||
+ | If nu=0 Then | ||
+ | WScript.Arguments.ShowUsage | ||
+ | WScript.Quit | ||
+ | end if | ||
+ | Key=UnNamed(0) | ||
+ | Select Case job | ||
+ | ' | ||
+ | Case " | ||
+ | i1=0 | ||
+ | i2=14 | ||
+ | s=1 | ||
+ | 'Big Endian | ||
+ | Case " | ||
+ | i1=14 | ||
+ | i2=0 | ||
+ | s=-1 | ||
+ | Case " | ||
+ | End Select | ||
+ | If job<>" | ||
+ | ' | ||
+ | j=0 | ||
+ | For index = i1 To i2 Step s | ||
+ | Sbyte="& | ||
+ | PK(j)=CInt(Sbyte) | ||
+ | j=j+1 | ||
+ | Next | ||
+ | PrintResult | ||
+ | Else | ||
+ | ' | ||
+ | j=0 | ||
+ | For index = 1 To len(Key) | ||
+ | ' | ||
+ | v=valueB24(Mid(Key, | ||
+ | If v>=0 Then | ||
+ | PK(j)=v | ||
+ | j=j+1 | ||
+ | End If | ||
+ | Next | ||
+ | If j<>25 Then | ||
+ | WScript.Arguments.ShowUsage | ||
+ | WScript.Quit | ||
+ | End If | ||
+ | ' | ||
+ | For i = 0 To 14 | ||
+ | Result(i)=0 | ||
+ | Next | ||
+ | NumDigits=24 | ||
+ | ResLen=15 | ||
+ | For i= 0 To 24 | ||
+ | Aux=PK(i) | ||
+ | m=0 | ||
+ | Do | ||
+ | Aux=Result(m)*NumDigits + Aux | ||
+ | Result(m)= Aux AND 255 | ||
+ | m=m+1 | ||
+ | Aux=int(Aux/ | ||
+ | Loop Until m >= ResLen | ||
+ | Next | ||
+ | For i = 0 To 14 | ||
+ | PK(i)=Result(i) | ||
+ | Next | ||
+ | PrintResult | ||
+ | End If | ||
+ | Case else | ||
+ | WScript.Arguments.ShowUsage | ||
+ | | ||
+ | End Select | ||
+ | |||
+ | Wscript.quit | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | Sub ExploreKey(CurKey) | ||
+ | coderet=oReg.GetBinaryValue(HKEY_LOCAL_MACHINE, | ||
+ | If CodeRet=0 Then | ||
+ | ' | ||
+ | For index = 0 to 14 | ||
+ | PK(index)=Buffer(index+& | ||
+ | Next | ||
+ | Key=CurKey | ||
+ | PrintResult | ||
+ | Exit Sub | ||
+ | end if | ||
+ | Dim arrSubKeys | ||
+ | ' | ||
+ | coderet=oReg.EnumKey(HKEY_LOCAL_MACHINE, | ||
+ | If codeRet=0 Then | ||
+ | If IsArray(arrSubKeys) Then | ||
+ | For Each subkey In arrSubKeys | ||
+ | ExploreKey(CurKey & " | ||
+ | Next | ||
+ | End If | ||
+ | end if | ||
+ | End Sub | ||
+ | ' | ||
+ | Sub PrintResult | ||
+ | RAWKeyBE="" | ||
+ | RAWKeyLE="" | ||
+ | ' | ||
+ | For index = 0 to 14 | ||
+ | RAWKeyBE=hexa(PK(index)) & RAWKeyBE | ||
+ | RAWKeyLE=RAWKeyLE & hexa(PK(index)) | ||
+ | Next | ||
+ | S="" | ||
+ | ' | ||
+ | For index = 0 To 3 | ||
+ | CurByte=PK(Index) | ||
+ | If index = 3 Then CurByte=CurByte and &H7F | ||
+ | S=Hexa(CurByte) & S | ||
+ | next | ||
+ | PID=int(("& | ||
+ | SPID=CStr(PID) | ||
+ | While len(SPID)< | ||
+ | SPID=" | ||
+ | Wend | ||
+ | SPID1=left(SPID, | ||
+ | SPID2=mid(SPID, | ||
+ | sigma=0 | ||
+ | For i = 1 To len(SPID2) | ||
+ | sigma=sigma+Asc(mid(SPID2, | ||
+ | Next | ||
+ | m=7-sigma mod 7 | ||
+ | SPID=SPID1 & " | ||
+ | ' | ||
+ | S="" | ||
+ | For i = 24 To 0 Step -1 | ||
+ | r = 0 | ||
+ | For j = 14 To 0 Step -1 | ||
+ | r = r * 256 Xor PK(j) | ||
+ | PK(j) = Int(r/24) | ||
+ | r = r Mod 24 | ||
+ | Next | ||
+ | S=CharSet24(r) & S | ||
+ | If i Mod 5 = 0 And i <> 0 Then S=" | ||
+ | Next | ||
+ | msg=VBCRLF | ||
+ | If BDR Then msg=msg & " | ||
+ | msg=msg & VBCRLF & " | ||
+ | msg=msg & VBCRLF & " | ||
+ | msg=msg & VBCRLF & " | ||
+ | ' Calcul du ProductID (central) | ||
+ | ' NB : valable seulement pour Windows, l' | ||
+ | ' être différent pour les autres produits | ||
+ | msg=msg & VBCRLF & " | ||
+ | If BDR Then | ||
+ | coderet=oReg.GetStringValue(HKEY_LOCAL_MACHINE, | ||
+ | If Coderet=0 Then msg=msg & VBCRLF & " | ||
+ | coderet=oReg.GetStringValue(HKEY_LOCAL_MACHINE, | ||
+ | If Coderet=0 Then msg=msg & VBCRLF & " | ||
+ | End If | ||
+ | Wscript.echo msg | ||
+ | End Sub | ||
+ | ' | ||
+ | ' | ||
+ | Function hexa(n) | ||
+ | ch=hex(n) | ||
+ | If len(ch)< | ||
+ | hexa=ch | ||
+ | End Function | ||
+ | ' | ||
+ | Function valueB24(c) | ||
+ | valueB24=-1 | ||
+ | c=ucase(c) | ||
+ | For i = 0 To 23 | ||
+ | If c=CharSet24(i) Then | ||
+ | valueB24=i | ||
+ | exit for | ||
+ | End If | ||
+ | Next | ||
+ | End Function | ||
+ | ' | ||
+ | ' | ||
+ | 'Vu les sorties générées, | ||
+ | 'qui doit être utilisé de préférence | ||
+ | Sub TestHost(force) | ||
+ | dim rep | ||
+ | strappli=lcase(Wscript.ScriptFullName) | ||
+ | strFullName =lcase(WScript.FullName) | ||
+ | i=InStr(1, | ||
+ | j=InStrRev(strFullName," | ||
+ | strCommand=Mid(strFullName, | ||
+ | if strCommand<>" | ||
+ | If force then | ||
+ | Init=" | ||
+ | Else | ||
+ | Init=" | ||
+ | End If | ||
+ | rep=MsgBox(Init & VBCRLF & _ | ||
+ | "Cela peut être rendu permanent avec la commande" | ||
+ | " | ||
+ | " | ||
+ | vbYesNo + vbQuestion, | ||
+ | if rep=vbYes | ||
+ | nomcmd=" | ||
+ | Set ficcmd = fso.CreateTextFile(nomcmd) | ||
+ | ficcmd.writeline "@echo off" | ||
+ | ficcmd.writeline " | ||
+ | ficcmd.writeline " | ||
+ | params="" | ||
+ | For i = 0 To nbargs-1 | ||
+ | params=params & " " & args(i) | ||
+ | next | ||
+ | ficcmd.writeline chr(34) & strappli & chr(34) & params | ||
+ | ficcmd.writeline " | ||
+ | ficcmd.close | ||
+ | shell.Run nomcmd, SW_SHOWNORMAL, | ||
+ | force=true | ||
+ | end if | ||
+ | If force then WScript.Quit | ||
+ | end if | ||
+ | end sub | ||
+ | ' | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Dans une fenêtre DOS, positionnez vous dans le dossier où le fichier **viewpk.wsf**, | ||
+ | <code DOS> | ||
+ | cscript viewpk.wsf | ||
+ | </ | ||
+ | |||
+ | Le résultat devrait de la forme suivante : | ||
+ | |||
+ | <code DOS> | ||
+ | ProductKey | ||
+ | RAWKey Big Endian | ||
+ | RAWKey Little Endian = 0049FC396000236A83A0027B2DD600 | ||
+ | ProductID calculé | ||
+ | ProductID BDR = 00400-OEM-0092002-00006 | ||
+ | ProductName | ||
+ | </ | ||
+ | |||
+ | ===== + d' | ||
+ | * [[http:// |