PowerShell script for adding Product Keys to Multi-Edition ISO's - PantherKeys.ps1

garlin

Moderator
Staff member
This script is for expert users, most of you won't need it.

When creating a multi-edition ISO, a major issue is trying to add individual Windows install or activation keys to each image.

autounattend.xml is shared by every image on the same ISO, and can only specify one product key. Normally this isn't a problem for W10/11 images, since unattended Setup doesn't require any keys and you leave it blank. But not in the case if you're adding W7 or W8 images, or need a permanent license for one or more editions.

The normal fix is to insert \Windows\Panther\unattend.xml in each image, with a listed product key. Unfortunately, NTLite doesn't have a bulk method of updating all of the images this way. So you're forced to do this manually, one image at a time.

PantherKeys.bat solves this problem by copying from autounattend.xml, looking up <ProductKey> from a pre-defined list, and writing a new Panther\unattend.xml to the image. By default the script will update all images, or just the images picked by index number(s).

1. Download the script.

2. Create the autounattend file as you would normally do. For a dual-architecture ISO, make sure you check the Dual architecture box. Make sure you also check the Prompt edition selection box.

Capture.PNG

3. Do not create an ISO, we're not ready for that step. Leave install.wim as WIM format.

4. Unload install.wim, if it's currently mounted.

5. If you have a permanent license key, edit the ProductKeys.json file and replace the matching line with your key. The script defaults to using Retail keys; switch to KMS keys by editing the PS script and replace ProductKeys.json with KMS_Keys.json.

6. Run the script as Admin, and provide your image folder's path. The script cannot run without finding autounattend & install.wim.
Code:
PantherKeys.bat F:\Releases\Win10_22H2_English_x64

Index Name                              Key
----- ----                              ---
1     Windows 10 Home                   YTMG3-N6DKC-DKB77-7M9GH-8HVX7
2     Windows 10 Home N                 4CPRK-NM3K3-X6XXQ-RXX86-WXCHW
3     Windows 10 Home Single Language   BT79Q-G7N6G-PGBYW-4YWX6-6F4BT
4     Windows 10 Education              YNMGQ-8RYV3-4PGQ3-C8XTP-7CFBY
5     Windows 10 Education N            84NGF-MHBT6-FXBX8-QWJK7-DRR8H
6     Windows 10 Pro                    VK7JG-NPHTM-C97JM-9MPGT-3V66T
7     Windows 10 Pro N                  2B87N-8KFHP-DKV6R-Y2C8J-PKCKT
8     Windows 10 Pro Education          8PTT6-RNW4C-6V7J2-C2D3X-MHBPB
9     Windows 10 Pro Education N        GJTYN-HDMQY-FRR76-HVGC7-QPF8P
10    Windows 10 Pro for Workstations   DXG7C-N36C4-C4HTG-X4T3X-2YV77
11    Windows 10 Pro N for Workstations WYPNQ-8C467-V2W6J-TX4WX-WT2RQ

#1: Windows 10 Home

Scanning "C:\Users\GARLIN\Downloads\PantherKeys\unattend.xml" (loading as WIM path: "\Windows\Panther\unattend.xml")...
10 KiB scanned (1 files, 0 directories)
Updating "\Windows\Panther\unattend.xml" in WIM image
Using LZX compression with 1 thread
Archiving file data 0 bytes of 0 bytes (0%) done
Calculating integrity table for WIM: 4883 MiB of 4883 MiB (100%) done

#2: Windows 10 Home N

Scanning "C:\Users\GARLIN\Downloads\PantherKeys\unattend.xml" (loading as WIM path: "\Windows\Panther\unattend.xml")...
10 KiB scanned (1 files, 0 directories)
Updating "\Windows\Panther\unattend.xml" in WIM image
Using LZX compression with 1 thread
Archiving file data 0 bytes of 0 bytes (0%) done
Calculating integrity table for WIM: 4892 MiB of 4892 MiB (100%) done
...

#11: Windows 10 Pro N for Workstations

Scanning "C:\Users\GARLIN\Downloads\PantherKeys\unattend.xml" (loading as WIM path: "\Windows\Panther\unattend.xml")...
10 KiB scanned (1 files, 0 directories)
Updating "\Windows\Panther\unattend.xml" in WIM image
Using LZX compression with 1 thread
Archiving file data 0 bytes of 0 bytes (0%) done
Calculating integrity table for WIM: 4970 MiB of 4970 MiB (100%) done

"F:\Y50-70\PURGE\Downloads\Releases\Win10_22H2_English_x64\sources\install.wim" original size: 5089361 KiB
Using LZX compression with 8 threads
Archiving file data 10 GiB of 10 GiB (100%) done
Calculating integrity table for WIM: 4874 MiB of 4874 MiB (100%) done
"F:\Y50-70\PURGE\Downloads\Releases\Win10_22H2_English_x64\sources\install.wim" optimized size: 4991957 KiB
Space saved: 97404 KiB

Limit the script to only updating a few images, by their index number:
Code:
PantherKeys.bat F:\Releases\Win10_22H2_English_x64 1 2 3 6

When done, the script will optimize the image to recover any increased space.

7. Now you can create the ISO, and optionally change to ESD compression. If you've updated anything in autounattend, re-run the script before making your final ISO.

I have tested my script against the normal W7, 8.1, 10 and 11 multi-edition ISO's It performs well against them. but I don't have copies of Server edition ISO's to confirm if it works or not. If you see any problems, report it to me.

Thanks to crypticus for promoting his Panther fix.
 

Attachments

  • PantherKeys.zip
    6.3 KB
If you want to check the unattend files, open install.wim with 7-Zip and look around so you don't need to extract the WIM.
 
Back
Top