0 Replies Latest reply on May 15, 2019 5:18 AM by johnsmain

    PowerCLI to automate export of host customizations

    johnsmain Lurker

      First Time Caller, Long Time Worshiper.

      Extensive Powershell and PowerCLI experience, but I've hit a wall.

       

      I am looking for a hint of how to automate the manual VC activity known as:

      Host Profiles -> Export Host Customizations

       

      I have the scripting in place to handle updating the resulting .csv with the new accounts and passwords.

      (The trick was to NOT use PowerCLI cmdlets to edit the _host_customizations.csv, but rather to use .NET to do the find/replace(s)

           $inFile = "c:\server.domain.com_host_customizations.csv"

           $outFile = "c:\server.domain.com_host_customizations_updated.csv"

           $content = [System.IO.File]::ReadAllText($inFile).Replace("oldpassword","newpassword")

           [System.IO.File]::WriteAllText($outFile, $content)

      )

       

      The obvious follow-on question would be how to automate the manual VC activity known as:

      Host Profiles -> Edit Host Customizations  and import the .csv

       

      We have to change the accounts and passwords used for AD access from the ESXi hosts routinely/monthly,

      and this is quite the mind-numbing process.

       

      Any assistance would be wonderful.