Regenerating Answer File from an Existing Device Using PkgScn and TAP
While the typical development scenario for Windows Embedded Standard 7 is to first create an Answer File in Image Configuration Editor (ICE) and then deploy that to a device, it is also possible to do the reverse and generate an Answer File from an existing device.
There are several cases where this is useful:
The original Answer File has been lost
Updates have been installed directly to the device (through Windows Update or manually), and you would like to replicate the configuration (including all updates) to install to other devices
Fortunately, the tools included in Standard 7 allow you to accomplish this in 3 easy steps:
Export a list of installed packages using PkgScn.exe
Generate the hardware configuration using Tap.exe
Import both of these into ICE to create the new Answer File
Now let’s look at each step in detail.
Step 1: Export a list of installed packages using PkgScn
This step can be performed either online or offline. For online, first use the script CopyPkgScn.cmd to copy PkgScn.exe and related binaries to the device. CopyPkgScn.cmd will be located in the folder C:\Program Files\Windows Embedded Standard 7\Tools\Image Configuration Editor. If your device is running a 64-bit OS, use the version of the script in the X64Apps folder to copy 64-bit binaries.
Once PkgScn is copied to the device, run the following command line to get the packages:
PkgScn /Get-Packages /ConfigsetDir:
Otherwise for offine we need one more parameter to specify the location of the mounted image. Images (WIM files) can be mounted using ImageX or Dism:
After this command completes, the package information will be placed in a file in the current directory named AutoUnattend.xml. Keep this file handy as we will need it in Step 3.
Step 2: Generate the hardware and driver configuration using Tap
Next we will run Tap.exe on the device to get hardware and driver information. You can find tap in the directory C:\Program Files\Windows Embedded Standard 7\Tools\Image Configuration Editor, or the X64Apps directory for the 64-bit version. Tap.exe can only be done on the device itself. Once Tap.exe is on the device run the following command line:
This will save the hardware and driver information to a file named devices.pmq in the local directory.
Step 3: Import files into ICE
Launch ICE and select File -> Open Answer File
Select the AutoUnattend.xml file you generated from Step 1.
You should now be able to see an Answer File populated with the packages from your device (the exact packages will depend on what has been installed):
Next we’ll add the hardware and driver information from Step 2. From the menu select File- > Import-> Import PMQ and select the devices.pmq file.
Now you should be able to see the drivers show up in the Answer File pane:
[Optional] Additional Setup Information from IBW Installations
If you set up the original device using IBW (Image Based Wizard), you can also recover any configuration or settings made at that time. This data will be on the device in the file C:\Windows\panther\cbs_unattend.xml. To use this data in ICE, copy this file from the device then go to File -> Import -> Template and select the file. It will now be in the Distribution Share pane inside the Templates folder, so simply drag it over to your Answer File.
One note of caution if you do use the cbs_unattend.xml file – any sensitive user data such as usernames and passwords will have been obfuscated after install, so you will need to re-enter these settings in ICE.
At this point, you can create a configuration set to deploy this Answer File to another device, or continue modifying the Answer File to meet your needs.
Before wrapping up though, there are a few caveats which I should mention.
Any updates which have been installed to the device but are not present in your Distribution Share will show up under “Unknown Packages.” You can fix this by downloading the updates from Embedded Communications Extranet (ECE) Microsoft OEM Online (MOO) or via Windows Embedded Developer Update (WEDU).
3rd party drivers or applications which were installed directly to the device will not be able to be replicated in the answer file
Settings will also not be able to be recovered from the device (other than the IBW settings described above)
If you installed a Service Pack as an update to the device, this will show up under “Unknown Packages” as Service Packs cannot be imported into the Distribution Share.