Windows

Procedures to Backup Windows Product Key: Windows 10

Windows 10 is a great OS. It has many improved features over the previous versions of windows. However, there may be cases when the OS may crash or get corrupted. In such situations, the installation of the OS is the main concern. And successfully complete the installations process, you will need the product key of your OS. It is very important to backup the Windows product key for such situations. 

Backing up the product key is not that a challenge in Windows 10. It is a 3 step process. With these 3 steps, you can make the life of your computer much longer.

Steps to backup Windows Product Key

So, let’s start with the process which will save your computer in the long run in case of some mishaps.   

Step- 1

At first, you have to press “Win+R” at the same simultaneously. In the new space, you have to write “notepad” and press “Enter”.

Step- 2

After the “Notepad” has opened, you have to copy the given script on to it:

#Main function

Function GetWin8Key

{

$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 “Microsoft Windows 8” -or $OSInfo -match “Microsoft 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 “WindowsKeybackup.txt” -Value $value -ItemType File -Force | Out-Null

}

Elseif($Choice -eq 1)

{

Exit

}

}

Else

{

Write-Warning “Please run this script on Windows 8.x or Windows 10”

}

}

Else

{

Write-Warning “Please run this script on Windows 8.”

}}

Else

{

Write-Warning “Failed to get Windows 8 product key,Some error occured.”

}}

#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 = “Confirming”

$message = “Save product key to a file?”

$result = $Host.UI.PromptForChoice($caption,$message,$choices,0)

$result

}

#Convert binary to serial number

Function ConvertToKey($Key)

{

$Keyoffset = 52

$isWin8 = [int]($Key[66]/6) -band 1

$HF7 = 0xF7

$Key[66] = ($Key[66] -band $HF7) -bOr (($isWin8 -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}

GetWin8Key

Step- 3

Now, you have to name the file followed by the extension “.ps1”. Then, you have to click “Save” and save the file at any location of your choice. 

However, if you want to make the backup safer, then you can take the help of PowerShell. It is a scripting language and a command-line shell, which is task-based. This is made primarily for system administration. It is used for controlling and automating the application that runs on Windows and the Windows OS, by the power users and the IT professionals.  

Backup Windows Product Key With PowerShell

At first, you have to download PowerShell. Then, you have to follow the given steps to successfully execute the backup process.

  1. First, you have to extract the downloaded WindowsKeybackup.rar file.
  2. Then, you have to right-click on your file with the extension “.ps1” and then select the option “Run with PowerShell” from the menu.
  3. When the PowerShell window will open, you have to type “Y” and then press “Enter”.

And that’s all you have to do to backup your windows product key by using PowerShell.  

Conclusion

So, by following these two methods, you will be able to successfully backup Windows product key of Windows 10. The traditional way of backup is good, but the method of backup by using PowerShell is much better. PowerShell will be able to give a more secure and flexible backup option.           

RobertChester

Recent Posts

Make1m.com Luxury Yachts: Cruise in Unmatched Style & Comfort!

The allure of luxury yachting has captivated travellers for decades, offering a unique blend of…

2 weeks ago

GameMakerBlog.net: Your Go-To Hub for Game Devs!

In the rapidly expanding world of game development, having access to the right resources and…

2 weeks ago

PonderShort.com: Dive into Short Stories!

With the digital age reshaping how we read and share stories, short-form literature has found…

3 weeks ago

Stars-923: Unveiling the Mystical Cosmos

Stars have captivated human imagination for millennia. Among the countless celestial objects in our universe,…

3 weeks ago

Luther of Keezy.co: Digital Marketing Wizardry

In today’s fast-paced digital landscape, the role of a skilled social media strategist is more…

3 weeks ago

8 Best Rugged Laptops: Built to Withstand Harsh Environment

In today's fast-paced, unpredictable world, having a durable and reliable laptop is crucial for many…

1 month ago