nebb2k8
Enthusiast
Enthusiast

PowerCLI / ESXCLI - Reset Host Customizations

Jump to solution

Hi All

Does anyone know how to Host > Host Profiles > Reset Host Customizations in PowerCLI or ESXCLI?

I am pushing host customizations via Invoke-VMHostProfile -Variable. But they do not appear visable until I do the reset.

Thanks

Ben

1 Solution

Accepted Solutions
LucD
Leadership
Leadership

No cmdlet I'm afraid.

But you can use the API method

$esxName = 'MyEsx'


$esx = Get-VMHost -Name $esxName

$hProfMgr = Get-View HostProfileManager

$spec = New-Object VMware.Vim.AnswerFileOptionsCreateSpec

$hProfMgr.UpdateAnswerFile($esx.Id,$spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

6 Replies
scott28tt
VMware Employee
VMware Employee

Moderator: Moved to PowerCLI

0 Kudos
LucD
Leadership
Leadership

No cmdlet I'm afraid.

But you can use the API method

$esxName = 'MyEsx'


$esx = Get-VMHost -Name $esxName

$hProfMgr = Get-View HostProfileManager

$spec = New-Object VMware.Vim.AnswerFileOptionsCreateSpec

$hProfMgr.UpdateAnswerFile($esx.Id,$spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

nebb2k8
Enthusiast
Enthusiast

This is it. Thank you very much.

While I have you. Is the following the best method of applying the host customizations?

Invoke-VMHostProfile - vSphere PowerCLI Cmdlets Reference

$requireInput = Invoke-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';

Invoke-VMHostProfile $vmhost -Profile $profile -Variable $requireInput;

0 Kudos
LucD
Leadership
Leadership

That is correct.

We do have a short section on this in the PowerCLI Reference.

Note Apply-VMHostProfile is now Invoke-VMHostProfile.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
nebb2k8
Enthusiast
Enthusiast

Is there anyway to get the required hash table without having to invoke the host profile?

$input_hash_table = Invoke-VMHostProfile $newdata.Host -Profile $profile -Confirm:$false;
0 Kudos
LucD
Leadership
Leadership

Not that I know of I'm afraid.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos