I have a script that I run againt my Production and Development Environments to automate the build of servers from a template.
The code is:
$vcenter = Connect-VIServer $vcenterName
$vHost = Get-VMHost -Name $vmHost
Get-OSCustomizationSpec -Name $osCustomization | New-OSCustomizationSpec -Name "oscustTEMP" -Type NonPersistent
Get-OSCustomizationSpec -Name "oscustTEMP" | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $ipAddress -SubnetMask $subnetMask -DefaultGateway $defaultGateway -Dns $dns
$vTemplate = Get-Template -Name $vmTemplate
$vDatastore = Get-Datastore -Name $vmDatastore
$vFolder = Get-Folder -Name $vmFolder
New-VM -Name $vm -Template $vTemplate -OSCustomizationSpec "oscustTEMP" -Location $vFolder -VMHost $vHost -Datastore $vDatastore -Confirm:$false
Start-VM -VM $vm -RunAsync
Disconnect-VIServer $vcenterName -Confirm:$false
When I run this against Production Environment the VM builds fine, but when I run it against my Development Environment and after the vim.event.CustomizationSucceeded I get the following error on the VM:
"Windows could not parse or process unattend answer file [C:\Windows\Panther\unattend.xml] for pass [oobeSystem]. The settigns specified in the answer file cannt be applied. The error was detected while processing settings for component [Microsoft-Windows-Shell-Setup]."
However, when I manually do a deploy from template and select the same OS Customization I do not get the above error and it works. It seems as if it may be an issue with the New-OSCustomizationSpec?
Any assistance would be greatly appreciate, please let me know if I need to supply any more details. Both environments are vCenter 5.1., 1123961.