I have a script that gets the required input for a Host Profile using Apply-VMHostProfile (PowerCLI 5.5). If I run this command using Invoke-VMHostProfile (PowerCLI 6.0 R2) it works fine if the profile requires additional input. If I run it on a host where the answer file is completed I get the error listed below. When I run the command in PowerCLI 5.5, it simply returns the Host Object. Is this possibly a bug?
Code:
$AdditionalConfig = Invoke-VMHostProfile $newhost -Profile $hostprofile -Confirm:$false
Error:
Invoke-VMHostProfile : 10/21/2015 1:06:18 PM Invoke-VMHostProfile
Required property value is missing from data object of type KeyAnyValue
while parsing serialized DataObject of type vmodl.KeyAnyValue
at line 1, column 286813
while parsing property "parameter" of static type ArrayOfKeyAnyValue
while parsing serialized DataObject of type vim.profile.PolicyOption
at line 1, column 286766
while parsing property "policyOption" of static type PolicyOption
while parsing serialized DataObject of type vim.profile.Policy
at line 1, column 286730
while parsing property "policy" of static type ArrayOfProfilePolicy
while parsing serialized DataObject of type vim.profile.host.SecurityProfile
at line 1, column 286697
while parsing property "security" of static type SecurityProfile
while parsing serialized DataObject of type vim.profile.host.HostApplyProfile
error parsing Any with xsiType HostApplyProfile
at line 1, column 19680
while parsing property "value" of static type anyType
while parsing serialized DataObject of type vmodl.KeyAnyValue
at line 1, column 19642
while parsing property "genericConfig" of static type ArrayOfKeyAnyValue
while parsing serialized DataObject of type vim.host.ConfigSpec
at line 1, column 357
while parsing call information for method ApplyHostConfig_Task
at line 1, column 218
while parsing SOAP body
at line 1, column 207
while parsing SOAP envelope
at line 1, column 38
while parsing HTTP request for method applyHostConfiguration
on object of type vim.profile.host.ProfileManager
at line 1, column 0
At line:1 char:21
+ $AdditionalConfig = Invoke-VMHostProfile $newhost -Profile $hostprofile -Confirm ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-VMHostProfile], InvalidRequest
+ FullyQualifiedErrorId : Client20_SystemManagementServiceImpl_ApplyVMHostProfile_ViError,VMware.VimAutomation.ViCore
.Cmdlets.Commands.Host.InvokeVMHostProfile
Was that host profile created with PowerCLI 5.5 or 6R2 ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Sorry for the late reply.....
No, the Host Profile was created within vCenter 5.5.
Any more ideas?
Update: VMware has confirmed this is a bug and have it slated for the next release.
Thanks for sharing that info
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference