Automation

 View Only
  • 1.  How to remove answer files from vCenter

    Posted Oct 15, 2015 09:59 PM

    I am trying to pre-populate vCenter with host IP address details, so when a stateless host boots using Auto Deploy it is effectively "zero touch" and can get to work straight away.

    I'm using Daniel Hiltgen's script which can be found here: Script to pre-answer static IP addresses for Auto Deploy hosts (stateless ESXi). I'm identifying hosts by mac address, and I have modified the script (using his notes) to reference a dvSwitch.

    I've created my CSV file, but every time I tried to run the script I get "Host 192.168.146.111 already has a valid answer file, skipping".  Now I'm not actually sure this is correct, but im testing this in a lab environment and it's possible I've tried every combination of IP address on my LAN.

    How can I leverage PowerCLI to see what answer files are defined, and if necessary remove them?

    I've tried using Get-View "HostProfileManager" but I didn't get very far.

    Any help would be greatly appreciated.

    -Mark



  • 2.  RE: How to remove answer files from vCenter
    Best Answer

    Posted Oct 16, 2015 06:37 AM

    You can see if an host named ESX1 has an answer file with:

    $hostProfileManagerView = Get-View -Id HostProfileManager

    $targetHost = Get-VMHost -Name ESX1

    $answerFile = $hostProfileManagerView.RetrieveAnswerFile($targetHost.ExtensionData.MoRef)

    There is no way to remove an answer file. Howerver you can update an existing answer file. If you remove the check on an existing answerfile in Daniel Hiltgen's script then the answerfile will be updated, if it already exists. To do this, you have to remove the following lines in Daniel's script::

    157 if (-not $answerFile) {

    182 } else {

    183 Write "Host $targetHost already has a valid answer file, skipping."

    184 }.



  • 3.  RE: How to remove answer files from vCenter

    Posted Apr 27, 2017 08:32 PM

    Is there any way to view the current values in the answer file.

    Thanks