return $key.Insert(20,"-").Insert(15,"-").Insert(10,"-").Insert(5,"-")
# Method A: Using WMI (Windows Management Instrumentation) wmic path softwarelicensingservice get OA3xOriginalProductKey function Get-WindowsKey $map = "BCDFGHJKMPQRTVWXY2346789" $value = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform").BackupProductKeyDefault $key = "" for ($i = 24; $i -ge 0; $i--) $key = $map[$value -shr (5*$i) -band 31] + $key how to backup windows 11 license key