diff --git a/scripts/Update-OvfConfiguration.ps1 b/scripts/Update-OvfConfiguration.ps1 index 1789676..1d75895 100644 --- a/scripts/Update-OvfConfiguration.ps1 +++ b/scripts/Update-OvfConfiguration.ps1 @@ -63,6 +63,22 @@ If ($OVFConfig.DeploymentConfigurations.Count -gt 0) { $XMLAttrTransport = $XML.CreateAttribute('transport', $XML.DocumentElement.ovf) $XMLAttrTransport.Value = 'com.vmware.guestInfo' [void]$XML.SelectSingleNode('//Any:VirtualHardwareSection', $NS).Attributes.Append($XMLAttrTransport) +ForEach ($ExtraConfig in $OVFConfig.AdvancedOptions) { + $XMLExtraConfig = $XML.CreateElement('vmw:ExtraConfig', $XML.DocumentElement.vmw) + + $XMLExtraConfigAttrRequired = $XML.CreateAttribute('required', $XML.DocumentElement.ovf) + $XMLExtraConfigAttrRequired.Value = "$([boolean]$ExtraConfig.Required)".ToLower() + $XMLExtraConfigAttrKey = $XML.CreateAttribute('key', $XML.DocumentElement.vmw) + $XMLExtraConfigAttrKey.Value = $ExtraConfig.Key + $XMLExtraConfigAttrValue = $XML.CreateAttribute('value', $XML.DocumentElement.vmw) + $XMLExtraConfigAttrValue.Value = $ExtraConfig.Value + + [void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrRequired) + [void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrKey) + [void]$XMLExtraConfig.Attributes.Append($XMLExtraConfigAttrValue) + [void]$XML.SelectSingleNode('//Any:VirtualHardwareSection', $NS).AppendChild($XMLExtraConfig) +} +Write-Host "Added $($OVFConfig.AdvancedOptions.Count) 'vmw:ExtraConfig' nodes" $XMLProductSection = $XML.SelectSingleNode('//Any:ProductSection', $NS) If ($XMLProductSection -eq $Null) {