VMware Cloud Community
LukasWe
Enthusiast
Enthusiast
Jump to solution

Reset Host Customizations via Workflow

Hi,

I want to reset the host customizations AND restore them from the current host configuration via a workflow.

In the vSphere Webclient it is easily possible in the menu when you right-click a host system (Host Profiles > Reset Host Customizations).

However, this actually executes an update on the host customizations for that host.

The API of the HostProfileManager (http://www.vroapi.com/Class/VC/6.5.0/VcHostProfileManager) provides me a lot of different methods to create/update/apply the host customizations but I always need either a valid VcAnswerFileCreateSpec or a VcStructuredCustomizations. I've tried this with default constructors and null values but nothing seems to work. The point is I really don't know how I restore the current config from the host into the answer file (host customizations) and I cannot find out what the vCenter is actually doing behind when I reset the host customizations via the web client.

Does anybody know how I could reset and restore the host customizations from an ESXi host?

Update:

My ultimate goal is to enter de required values for the host customization automatically with the current configuration of the host itself.

I need this for re-installation/upgrade purposes. Because in the past someone might have changed the configuration without reflecting the change to the answer file.

With this workflow I want to make sure, that the answer file/host customizations reflect the current host configuration to 100%.

Maybe there is an easier way... If there is, please let me know Smiley Happy

Regards,

Lukas

Reply
0 Kudos
1 Solution

Accepted Solutions
LukasWe
Enthusiast
Enthusiast
Jump to solution

In case if someone needs it also..

This few lines reset the host customizations and restores them from the host:

in_host of type VcHostSystem

resetHostCustomizationsTask of type VcTask which can afterwards be executed with the action vim3WaitTaskEnd.

var hostProfileManager = in_host.sdkConnection.hostProfileManager;

var configSpec = new VcAnswerFileOptionsCreateSpec();

configSpec.userInput = new Array();

resetHostCustomizationsTask = hostProfileManager.updateAnswerFile_Task(in_host, configSpec);

View solution in original post

Reply
0 Kudos
2 Replies
LukasWe
Enthusiast
Enthusiast
Jump to solution

I appreciate your comment. But I would like to perform the restore of the answer file directly within the Orchestrator and without the need of e.g. an additional PowerShell host. You can do really much with the HostProfile-API but a reset/restore seems pretty hard. I guess the only way is to read out every required answer file user input manually from the host and update the answer file afterwards. I think there is no solution to trigger this resetting functionality so that the current values are read out from the host automatically.

Reply
0 Kudos
LukasWe
Enthusiast
Enthusiast
Jump to solution

In case if someone needs it also..

This few lines reset the host customizations and restores them from the host:

in_host of type VcHostSystem

resetHostCustomizationsTask of type VcTask which can afterwards be executed with the action vim3WaitTaskEnd.

var hostProfileManager = in_host.sdkConnection.hostProfileManager;

var configSpec = new VcAnswerFileOptionsCreateSpec();

configSpec.userInput = new Array();

resetHostCustomizationsTask = hostProfileManager.updateAnswerFile_Task(in_host, configSpec);

Reply
0 Kudos