Posts

Showing posts from May, 2021

How to find Windows License information after the installation

Image
 Hi, Requirement : We need to set up or move existing windows to server or OS to a newer environment, but at that moment we find that we do not have the Windows Genuine Keys. Login to the PC which keys need to be found Create a new notepad and paste following code block; function Get-WindowsKey {     ## function to retrieve the Windows Product Key from any PC     ## by Nedim Mehic     param ($targets = ".")     $hklm = 2147483650     $regPath = "Software\Microsoft\Windows NT\CurrentVersion"     $regValue = "DigitalProductId"     Foreach ($target in $targets) {         $productKey = $null         $win32os = $null         $wmi = [WMIClass]"\\$target\root\default:stdRegProv"         $data = $wmi.GetBinaryValue($hklm,$regPath,$regValue)         $binArray = ($data.uValue)[52..66]         $charsArray = "B","C","D","F","G","H","J","K","M","P","Q"