Hi,
I tried applied a hostprofile to a HV in maint mode with
Apply-VMHostProfile -Entity xxx -Profile yyy -Confirm:$false
The names of the required variables and the current or default values is returned..but that is not going to help me. The doc does not explain what to do next
https://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Apply-VMHostProfile.html
Can someone has any handy script for this.. I saw in google.. it talks about the answer file, tho i do not remember me doing anything manually for that thing. I would simply do "check complience" & then "apply profile" ...
thanks
You have to store the answer in a hash table and pass that table on the Variable parameter.
See example 4 on the Apply-VMHostProfile help.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Eg 4 ?
It does not talk about the variable
Get-VMHost | Apply-VMHostProfile -AssociateOnly -profile $profile
I think you mean eg 6...
-------------- Example 6 --------------
$requireInput = Apply-VMHostProfile $vmhost -Profile $profile;
$requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.address'] = '192.168.0.1';
$requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.subnetmask'] = '255.255.255.0';
Apply-VMHostProfile $vmhost -Profile $profile -Variable $requireInput;
Correct, it was Example 4 in a previous PowerCLI version.
My bad
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
i intalled 5.8 .. BTW i followed as it is, it but gives err
Apply-VMHostProfile : 9/16/2014 11:18:34 PM | Apply-VMHostProfile | Inval |
id profile variable(s): 'network.hostPortGroup["key-vim-profile-host-HostPortgr
oupProfile-VMkernel"].ipConfig.IpAddressPolicy.subnetmask, network.hostPortGrou
p["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolic
y.address'.
At line:1 char:20
+ Apply-VMHostProfile <<<< xxxxx -Profile xxx -Variable $requireInput;
+ CategoryInfo | : InvalidArgument: (:) [Apply-VMHostProfile], VimE |
xception
+ FullyQualifiedErrorId : Client20_SystemManagementServiceImpl_ApplyVMHost |
Profile_InvalidVariable,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.
ApplyVMHostProfile
Is the Host profile configured to prompt for these properties ?
Do a
$requireInput = Apply-VMHostProfile $vmhost -Profile $profile
$requireInput.GetEnumerator()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I filled in $vmhost & $profile , manually .. ie with variable .. the absolute hostname & profile name
I tried to with variable
Ok i did add $requireInput.GetEnumerator();
it asked Q i typed Y
But then same error
final one was
$requireInput = Apply-VMHostProfile xxxx -Profile xxx;
$requireInput.GetEnumerator();
$requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.address'] = 'xxxx';
$requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.subnetmask'] = '255.255.255.0';
Apply-VMHostProfile xxxx -Profile xxx -Variable $requireInput;
I tried again with the variables ... gives me err
Apply-VMHostProfile : Cannot bind parameter 'Entity'. Cannot convert the "Syste
m.Management.Automation.Internal.Host.InternalHost" value of type "System.Manag
ement.Automation.Internal.Host.InternalHost" to type "VMware.VimAutomation.ViCo
re.Types.V1.Inventory.InventoryItem".
At line:1 char:20
+ Apply-VMHostProfile <<<< $host -Profile $profile -Variable $requireInput ;
+ CategoryInfo : InvalidArgument: (:) [Apply-VMHostProfile], Para
meterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomat
ion.ViCore.Cmdlets.Commands.Host.ApplyVMHostProfile