VMware Cloud Community
nebb2k8
Enthusiast
Enthusiast
Jump to solution

PowerCLI / ESXCLI - Reset Host Customizations

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
Jump to solution

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
Jump to solution

Moderator: Moved to PowerCLI


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

nebb2k8
Enthusiast
Enthusiast
Jump to solution

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
Jump to solution

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
Jump to solution

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
Jump to solution

Not that I know of I'm afraid.


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

0 Kudos