Title: Install Windows The unattend answer file contains an invalid product key. Either remove the invalid key or provide a valid product key in the unattend answer file to proceed with Windows installation.
Screenshot from Microsoft Deployment Tools 2012:
Operating system deployment did not complete successfullyPlease review the log files to determine the cause of the problem.
During the deployment process, 9 errors and 0 warnings were reported. Details... Setup failed applying image \\server\DeploymentShare$\Operating Systems\ Windows Server 2008 R2 x64\Sources\install.wim, rc = 31ZTI ERROR - Non-zero return code by LTIApply, rc = 31
Litetouch deployment failed, Return Code = -2147467259 0x80004005 Failed to run the action: Install Operating System. A device attached to the system is not functioning. (Error: 0000001F; Source: Windows) The execution of the group (Install) has failed and the execution has been aborted. An action failed.Operation aborted (Error: 80004004; Source: Windows)
Failed to run the last action: Install Operating System. Execution of task sequence failed. [...]
I've found that the simplest way of doing this is starting '''an administrator''' PowerShell console and navigating to
An example of the commands to execute for the "notepad method" is:
PS C:\> cd "C:\DeploymentShare\control\2008R2CORE-001" PS C:\DeploymentShare\control\2008R2CORE-001> notepad unattend.xml
I wrote a one-liner that does it with a pretty nasty regexp (read more about PowerShell regular expressions here). This isn't best practices by any means, but I'm adding it anyway. Be aware that you can't copy/paste the command from this page directly into the PowerShell console window, because I added newlines for readability.
This one-liner will open Unattend.xml (gc .\Unattend.xml), join it with newlines and run my magic regexp against the string. Then this will be split on newlines again to preserve layout. Then it's piped to Where-Object/?/Where, which removes blank lines; otherwise you will have a blank line, but it doesn't break the XML, so it's not strictly necessary. Then it's finally piped to Out-File which saves it to "Unattend-temp.xml", using UTF-8 encoding.PS C:\DeploymentShare\control\2008R2CORE-001> ((gc .\Unattend.xml) -join "`n" -ireplace '(?s)(.*?) )', '${1}${2}') -split "`n" | ? { $_ -match '\S' } | Out-File -Encoding utf8 .\Unattend-temp.xml.*? (.*?[^<]* .*?
Here is a paste-friendly version:
((gc .\Unattend.xml) -join "`n" -ireplace '(?s)(.*?) )', '${1}${2}') -split "`n" | ? { $_ -match '\S' } | Out-File -Encoding utf8 .\Unattend-temp.xml.*? (.*?[^<]* .*?
First, we can look at what's in the UserData section in the original file:
PS C:\DeploymentShare\control\2008R2CORE-001> ((gc .\Unattend.xml) -join "`n") -match '(?s)(\s+.+? )'; $matches[1] Truetrue 12345-ABCDE-12345-ABCDE-12345
Then look at the temp file we created with the one-liner above to see that the product key and the tags indeed are removed from the UserData section:
PS C:\DeploymentShare\control\2008R2CORE-001> ((gc .\Unattend-temp.xml) -join "`n") -match '(?s)(\s+.+? )'; $matches[1] Truetrue
PS C:\DeploymentShare\control\2008R2CORE-001> move .\Unattend.xml .\Unattend-old.xml PS C:\DeploymentShare\control\2008R2CORE-001> move .\Unattend-temp.xml Unattend.xmlWindows Microsoft Deployment Tools Powershell All Categories
Minimum cookies is the standard setting. This website uses Google Analytics and Google Ads, and these products may set cookies. By continuing to use this website, you accept this.