Unattended Windows setup may fail due to long computer name

While testing unattended Windows deployment I encountered another problem.

After the first installation reboot, Windows setup would fail with the error message:

Windows could not parse or process unattend answer file [C:\Windows\Panther\unattend.xml] for pass [specialize]. The answer file is invalid.

 

When closing the dialogbox the computer restarted.

 

Then it failed with this error message:

The computer restarted unexpectedly or encountered an unexpected error. Windows instalation cannot proceed. To install Windows, click "OK" to restart the computer, and then restart the installation.

 

Started troubleshooting by booting into Windows PE.

Started examining the log files under:

C:\Windows\Panther

 

Found these error messages in setupact.log:

IBS    The provided unattend file is not valid; hrResult = 0x80220005
IBS    Callback_Unattend_InitEngine:The provided unattend file [C:\Windows\Panther\unattend.xml] is not a valid unattended Setup answer file; hr = 0x1, hrSearched = 0x1, hrDeserialized = 0x0, hrImplicitCtx = 0x0, hrValidated = 0x1, hrResult = 0x80220005
IBS    UnattendErrorFromResults: Error text = Windows could not parse or process unattend answer file [C:\Windows\Panther\unattend.xml] for pass [specialize]. The answer file is invalid.
IBS    Callback_Unattend_InitEngine:An error occurred while finding/loading the unattend file; hr = 0x1, hrResult = 0x80220005

 

This didn’t reveal the exact cause of the error, but it inspired me to examine unattend.xml.

I transferred unattend.xml to my work computer and then tried opening the unattend.xml file with Windows System Image Manager.

 

However this failed with:

windows_sim_validation_error_waspassprocessed_attribute_is_not_declared

Validation error on D:\ToBeDeleted\Fail_Info\Panther\unattend.xml, line 18, column 32.

Details: The 'wasPassProcessed' attribute is not declared.

 

Opened the unattend.xml file in an editor and removed all instances of:

 wasPassProcessed="true"

 

After that the file could be opened in Windows SIM, which now displayed the real error:

The 'ComputerName' element is invalid - The value 'DeployTestPhysical' is invalid according to its datatype 'ComputerNameType' - The actual length is greater than the MaxLength value.

 

So the problem was that computer name was too long…

 

The unattend.xml file was modified by a custom program just before deployment on the target computer.

This custom program did not prevent computer names longer than 15 characters.

The problem was fixed by updating the custom program.

Conclusion

Special care should be taken when modifying unattend.xml by scripts or programs.

An invalid unattend.xml file may cause problems during Windows setup, which are not immediately obvious.

Unattended Windows setup may fail due to wrongly encoded password

While testing unattended Windows deployment I encountered a problem.

After the first installation reboot, Windows setup would fail with an empty dialog box:

install_windows_empty

 

Followed by the error message:

install_windows_windows_could_not_complete_the_installation

Windows could not complete the installation. To install Windows on this computer, restart the installation.

 

Then the machine would countinually reboot and show the last message.

 

Started troubleshooting by booting into Windows PE.

Then examined setuperr.log and setupact.log under:

C:\Windows\Panther\

However these files contained no useful clues.

 

I checked the other files left by Windows setup, and examined the files under:

C:\Windows\Panther\UnattendGC\

Found this in setuperr.log:

[oobeldr.exe] [Action Queue] : Unattend action failed with exit code 4
[oobeldr.exe] Execution of unattend GCs failed; hr = 0x0; pResults->hrResult = 0x8030000b
[oobeldr.exe] User input error was detected in unattend file. Error: [0x0]

[windeploy.exe] Command [%windir%\system32\oobe\oobeldr.exe /system] failed with exit code [0x8030000b]
[windeploy.exe] Failure occured during online installation.  Online installation cannot complete at this time.; hr = 0x8030000b

 

But it was a warning in setupact.log which revealed the cause behind the error:

[Shell Unattend] Failed to decode password (0x8007000d)

 

My initial understanding of the user password format in AutoUnattend.xml turned out to be wrong.

This problem was not discovered by Windows System Image Manager, because AutoUnattend.xml was updated just before deployment by a custom program on the target computer.

 

Local user passwords are encoded like this in AutoUnattend.xml:

1. Text is initially encoded as unicode / UTF-16.

2. Then a “Password” string is appended to the password.
Example: The password “1234” is represented as “1234Password”

3. Finally the password string is base64 encoded.

Problems when reusing AutoUnattend.xml with new Windows image

I recently experienced problems when reusing AutoUnattend.xml, after having upgraded the Windows image:

From: Windows 10 Enterprise 2015 LTSB

To: Windows 10 Enterprise 2016 LTSB

 

The unattended installation would start and run, but eventually failed with:

windows_setup_windows_could_not_apply_unattend_settings_during_pass_offlineservicing

Windows could not apply unattend settings during pass [offlineServicing].

 

Examined the installation logfiles under:

\$WINDOWS.~BT\Sources\Panther

 

setuperr.log only contained:

2016-10-20 15:20:20, Error      [0x0606ae] IBS    [SetupCl library] Required profile hive does not exist: [\??\D:\WINDOWS\system32\config\systemprofile\NTUSER.DAT].
2016-10-20 15:20:37, Error      [0x0604a7] IBS    InstantiateCBSUnattendPass: dism.exe returned with failing exit code -2146498555
2016-10-20 15:20:37, Error      [0x060431] IBS    Callback_UnattendInitiatePass: An error occurred while initiating unattend passes; hr = 0x80004005

 

setupact.log contained no additional useful information.

 

However cbs_unattend.log contained an explanation:

2016-10-20 15:20:36, Error                 DISM   DISM Package Manager: PID=2348 TID=2368 Failed opening package Microsoft-Windows-Foundation-Package~31bf3856ad364e35~amd64~~10.0.10240.16384. - CDISMPackageManager::Internal_CreatePackageByName(hr:0x800f0805)
2016-10-20 15:20:36, Error                 DISM   DISM Package Manager: PID=2348 TID=2368 Failed to get the underlying cbs package. - CDISMPackageManager::OpenPackageByName(hr:0x800f0805)
2016-10-20 15:20:36, Error                 DISM   DISM Package Manager: PID=2348 TID=2368 The specified package is not valid Windows package. - GetCbsErrorMsg

 

I wondered why the Microsoft-Windows-Foundation-Package could not be opened, so I went back to Windows System Image Manager.

windows_system_image_manager_unknown_package

There I noticed that the package was unknown, because the version numbers had changed.

Be aware that I had run: Tools -> Validate Answer File

(Which did not show warnings about this)

 

Added the new Microsoft-Windows-Foundation-Package

Then copied all the settings

After verifying that all settings had been copied, I deleted the unknown package.

(It would probably have been easier to update the version number in AutoUnattend.xml, which I recommend trying first)

 

Then ran: Tools -> Validate Answer File

Which now showed these warnings:

Windows Feature is enabled but one or more of its dependencies have not been enabled in the answer file.

Packages/Foundation/amd64_Microsoft-Windows-Foundation-Package_10.0.14393.0__31bf3856ad364e35_/Client-DeviceLockdown/Client-EmbeddedBootExp
Packages/Foundation/amd64_Microsoft-Windows-Foundation-Package_10.0.14393.0__31bf3856ad364e35_/Client-DeviceLockdown/Client-EmbeddedLogon
Packages/Foundation/amd64_Microsoft-Windows-Foundation-Package_10.0.14393.0__31bf3856ad364e35_/Client-DeviceLockdown/Client-EmbeddedShellLauncher

 

I was challenged by this until I found the answer here:

http://blog.theatticnetwork.net/2014/08/windows-unattend-file-notes/

 

I had to right-click the feature in question and choose: Enable Parent Features

windows_system_image_manager_enable_parent_features

 

After making these changes new configuration sets / deployment images could be installed successfully.

Conclusion

When reusing AutoUnattend.xml with a new Windows image, please look for unknown packages in Windows SIM in addition to validating the answer file.

If any unknown packages are found, please update the version numbers in AutoUnattend.xml.

Syntax errors due to wrong, but similar looking characters

I recently encountered problems when testing unattended Windows deployment.

A PowerShell script for setting up ShellLauncher did not seem to run.

 

Found this log message:

Encoding_issue_01

C:\Windows\system32>Powershell.exe –ExecutionPolicy RemoteSigned -NoProfile -NonInteractive c:\Install\PowerShell\ShellLauncher-setup.ps1
–ExecutionPolicy : The term '–ExecutionPolicy' is not recognized as the name of a cmdlet, function, script file, or ope
rable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again

 

This puzzled me because –ExecutionPolicy seemed correct.

 

When running the script manually from cmd.exe the cause of the problem became apparent:

Encoding_issue_02

ûExecutionPolicy : The term 'ûExecutionPolicy' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.

 

I examined which character was actually used instead of minus. It was – (en dash, 150) in Windows code page 1252 Latin 1 (ANSI).

PowerShell expects minus for options and interprets en dash as part of a cmdlet, function, script or program name.

 

Conclusion

No matter what code page and encoding is used many characters look similar to human eyes, but not to a computer.

If you encounter syntax problems for code or data that looks correct, I recommend checking the encoding and the actual character bytes with a hex editor.

Deployment error: Windows could not create a partition

I recently encountered problems when deploying Windows (using AutoUnattend.xml) on a test machine.

Installation failed with the message:

Windows_could_not_create_a_partition_on_disk_0

Windows could not create a partition on disk 0. The error occured while applying the unattend answer file’s <DiskConfiguration> setting. Error code: 0x80042565

 

I found these errors in: X:\Windows\Panther\setuperr.log

CreatePartition: Disk 0 doesn't support creation of partitions of the specified type
ApplyDiskOperationUsingService: Failed to correctly apply disk operation of type [0x7]; hr = 0x80042565
CallBack_DiskConfiguration_ApplyUnattend:An error occurred while applying unattend disk configuration; hr = 0x80042565

 

The situation occured because the computer booted in BIOS mode, while the DiskConfiguration specified in AutoUnattend.xml was for UEFI.

(I suspect that similar problems will occur in the opposite situation)

When actively choosing UEFI in the boot menu, it worked as expected.

 

In Windows PE the firmware type can examined by checking the registry key:

HKLM\System\CurrentControlSet\Control\PEFirmwareType

 

If booting in a particular mode is desired, the deployment media can be modified to achieve this:

  • UEFI, not BIOS: Remove bootmgr file from media root.
  • BIOS, not UEFI: Remove efi folder from media root.

 

Discovered the details about identifying firmware type and enforcing booting from a particular firmware type in the article: WinPE: Boot in UEFI or legacy BIOS mode

Media driver error at Windows 10 setup

I experienced a strange problem when trying to install Windows 10 on an Asus K52J laptop from a Verbatim Store ‘n’ Go 16 GB USB drive.

After booting Windows 10 setup and clicking “Install now” I saw the message: Setup is starting

And then this error message:

A media driver your computer needs is missing. This could be a DVD, USB or Hard disk driver. If you have a CD, DVD, or USB flash drive with the driver on it, please insert it now.

Note: If the installation media for Windows is in the DVD drive or on a USB drive, you can safely remove it for this step.

 

Followed by this error message:

No device drivers were found. Make sure that the installation media contains the correct drivers, and then click OK.

 

Common explanations for this error

  • Corrupted ISO file.

(I checked the SHA1 checksum, which was correct)

  • Wrong AHCI/SATA/IDE setting in BIOS.

(I tried the available options, which had no effect)

  • Using a USB 3.0 port instead of a USB 2.0 port.

(The machine only has USB 2.0 ports. Tried all the ports anyway, which didn’t change the situation)

 

Solution

I eventually found and tried the solution suggested by 4TXTECH here:

http://www.tomshardware.co.uk/forum/id-2762791/win10-clean-install-fails-missing-media-drivers.html

Setup could continue after following this procedure:

1. Unplug the USB drive.

2. Plug the USB drive into a different USB port.

3. Go back to the initial setup screen (by clicking X).

4. Click “Install now” again

 

Thoughts

The problem seems to be caused by a USB compatibility issue somewhere between Windows 10, the laptop or the USB drive.

Further investigation could be relevant.

If Windows installation from a USB flash drive fails due to this or other problems, try the suggested workaround.

As an alternative, try installing from a DVD (if possible).