VMware Cloud Community
nandymamith
Contributor
Contributor

Edit configuration files of a deployed VM

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. 

Labels (1)
Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos