Automation

 View Only
  • 1.  Edit configuration files of a deployed VM

    Posted Jan 20, 2023 04:17 AM

    Hi,

    Is it possible to edit the config files of a deployed VM using PowerCLI commands? If yes, can you share with me a sample code to edit '/etc/hosts' file of a deployed VM using PowerCLI commands.

    To elaborate a bit, I have deployed a VM over a ESX and need to change the static IP address of that VM by editing '/etc/hosts' file. My requirement is that can I achieve it from PowerCLI commands, without logging into that VM from Console and perform the same manually. 



  • 2.  RE: Edit configuration files of a deployed VM

    Posted Jan 20, 2023 12:07 PM

    You could use the Invoke-VMScript cmdlet, provided VMware Tools are installed in the Guest OS of the VM.
    Run a bash script where you use the sed command to edit the file.