0% found this document useful (0 votes)
62 views5 pages

Cum Pot Afla Cheia Windows 10

This document provides instructions for using a PowerShell script to find the product key for Windows 10 installed on a computer. It explains that you need to copy the script code into a file with a .ps1 extension, run PowerShell as administrator, set the execution policy, and run the script file to display the installed product key. It also provides options to save the key information to a text file.

Uploaded by

tonibsc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views5 pages

Cum Pot Afla Cheia Windows 10

This document provides instructions for using a PowerShell script to find the product key for Windows 10 installed on a computer. It explains that you need to copy the script code into a file with a .ps1 extension, run PowerShell as administrator, set the execution policy, and run the script file to display the installed product key. It also provides options to save the key information to a text file.

Uploaded by

tonibsc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Cum pot afla cheia Windows 10 instalat utilizand

PowerShell
In momentul de fata nu exista o comanda simpla pentru PowerShell sau Linie de comanda,
pentru a afla cheia sistemului de operare instalat (exista o comanda, care afiseaza cheia in
UEFI, voi arata mai jos. Doar ca de obicei utilizatorul are nevoie de cheia sistemului actual,
care difera de cel preinstalat). Poti sa te folosesti de scriptul PowerShell, care afiseaza
informatia necesara (autorul scriptului Jakob Bindslet).

Iata ca trebuie sa faci. In primul rand, porneste Notepat si copiaza in el codul de mai jos:

#Main function
Function GetWin10Key
{
$Hklm = 2147483650
$Target = $env:COMPUTERNAME
$regPath = "Software\Microsoft\Windows NT\CurrentVersion"
$DigitalID = "DigitalProductId"
$wmi = [WMIClass]"\\$Target\root\default:stdRegProv"
#Get registry value
$Object = $wmi.GetBinaryValue($hklm,$regPath,$DigitalID)
[Array]$DigitalIDvalue = $Object.uValue
#If get successed
If($DigitalIDvalue)
{
#Get producnt name and product ID
$ProductName = (Get-itemproperty -Path
"HKLM:Software\Microsoft\Windows NT\CurrentVersion" -Name
"ProductName").ProductName
$ProductID = (Get-itemproperty -Path
"HKLM:Software\Microsoft\Windows NT\CurrentVersion" -Name
"ProductId").ProductId
#Convert binary value to serial number
$Result = ConvertTokey $DigitalIDvalue
$OSInfo = (Get-WmiObject "Win32_OperatingSystem" | select
Caption).Caption
If($OSInfo -match "Windows 10")
{
if($Result)
{

[string]$value ="ProductName : $ProductName


`r`n" `
+ "ProductID : $ProductID `r`n" `
+ "Installed Key: $Result"
$value
#Save Windows info to a file
$Choice = GetChoice
If( $Choice -eq 0 )
{
$txtpath =
"C:\Users\"+$env:USERNAME+"\Desktop"
New-Item -Path $txtpath -Name
"WindowsKeyInfo.txt" -Value $value -ItemType File -Force | Out-Null
}
Elseif($Choice -eq 1)
{
Exit
}
}
Else
{
Write-Warning "Porneste scriptul in Windows
10"
}
}
Else
{
Write-Warning "Porneste scriptul in Windows 10"
}

}
Else
{
Write-Warning "A aparut o eroare, nu s-a putut afisa cheia
de produs"
}

}
#Get user choice
Function GetChoice
{
$yes = New-Object System.Management.Automation.Host.ChoiceDescription
"&Yes",""
$no = New-Object System.Management.Automation.Host.ChoiceDescription
"&No",""
$choices =
[System.Management.Automation.Host.ChoiceDescription[]]($yes,$no)
$caption = "Confirmare"
$message = "Salvezi cheia intr-un fisier text?"
$result = $Host.UI.PromptForChoice($caption,$message,$choices,0)
$result
}
#Convert binary to serial number
Function ConvertToKey($Key)
{
$Keyoffset = 52
$isWin10 = [int]($Key[66]/6) -band 1
$HF7 = 0xF7
$Key[66] = ($Key[66] -band $HF7) -bOr (($isWin10 -band 2) * 4)
$i = 24
[String]$Chars = "BCDFGHJKMPQRTVWXY2346789"
do
{
$Cur = 0
$X = 14
Do
{
$Cur = $Cur * 256
$Cur = $Key[$X + $Keyoffset] + $Cur
$Key[$X + $Keyoffset] =
[math]::Floor([double]($Cur/24))
$Cur = $Cur % 24
$X = $X - 1
}while($X -ge 0)
$i = $i- 1
$KeyOutput = $Chars.SubString($Cur,1) + $KeyOutput
$last = $Cur
}while($i -ge 0)
$Keypart1 = $KeyOutput.SubString(1,$last)
$Keypart2 = $KeyOutput.Substring(1,$KeyOutput.length-1)
if($last -eq 0 )
{
$KeyOutput = "N" + $Keypart2
}
else
{
$KeyOutput =
$Keypart2.Insert($Keypart2.IndexOf($Keypart1)+$Keypart1.length,"N")
}
$a = $KeyOutput.Substring(0,5)
$b = $KeyOutput.substring(5,5)
$c = $KeyOutput.substring(10,5)
$d = $KeyOutput.substring(15,5)
$e = $KeyOutput.substring(20,5)
$keyproduct = $a + "-" + $b + "-"+ $c + "-"+ $d + "-"+ $e
$keyproduct

}
GetWin10Key

Salveaza fisierul cu extensia .ps1. Pentru a face acest lucru in Notepad, in timpul salvarii in
campul «Salvare cu tipul» selecteaza «Toate fisirele» in loc de «Documente text». Poti salva,
de exemplu, sub numele win10key.ps1

Dupa aceea, porneste PowerShell cu drepturi de administrator. Pentru a face acest lucru, poti
sa tastezi PowerShell in caseta de cautare, si apoi sa apesi pe el cu butonul drept al mouse-ului
si sa selectezi punctul corespunzator.
In PowerShell introdu comanda: Set-ExecutionPolicy RemoteSigned si confirma rularea ei
(tasteaza Y si apasa Enter ca raspuns la solicitare).

Urmatorul pas, introdu comanda: C:\win10key.ps1 (in aceasta comanda se specifica calea
catre fisierul cu scriptul salvat).
Ca rezultat al comenzii vei vedea informatii despre cheia Windows 10 instalat (in punctul
Installed Key) si solicitarea de a salva intr-un fisier text. Dupa ce ai aflat cheia produsului,
poti sa revii la politica executarii scriptului in PowerShell la starea implicita cu ajutorul
comenzii Set-ExecutionPolicy restricted

You might also like