2 Replies Latest reply on Oct 4, 2019 10:16 AM by aslk5

    remidiate Host Profiles

    Daniel Langenhan Enthusiast

      Hi all,

      I been hammering away at this but I'm having trouble.

       

      System: vCenter 6.7, vRO  7.6

      Objective: remediate (apply host profile) to esxi after changing some content of the Answer file.

      What I have: I have added a host profile to the Cluster, added a new ESXi, changed the answer file content

      What I cant figure out: How to apply the host profile.

       

      API tells me to use: VcHostProfileManager.applyHostConfig_Task() however it requires VcHostConfigSpec and I cant find to get them.

       

      Anyone?

        • 1. Re: remidiate Host Profiles
          Daniel Langenhan Enthusiast

          oh well...

          Sometimes it helps just to step away...

          here the answer:

          profile=hostProfileManager.findAssociatedProfile(host)[0];
          exec=profile.executeHostProfile(host);
          
          taskID=hostProfileManager.applyHostConfig_Task(host,exec.configSpec);
          stuff=System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(taskID,false,2);
          

           

          The problem was that I didn't realize that the type vc:Profile is the same as the type vc:HostProfile

          1 person found this helpful
          • 2. Re: remidiate Host Profiles
            aslk5 Novice

            Hi Daniel,

             

            Can you share part of your code for what you did to edit the answer file? I've managed to pick the profile I want, apply it to the host and do the remediation (with the help of your code above) but the trying to feed in all the answers are giving me a little trouble.

             

            Anything you can share would be helpful

             

            thanks