[How To]: Change Linux IP Address via PowerCLI

There is some reason that you want to change IP address on virtual machines as an example, moving virtual machines to a new VLAN or port-group or moving them to another site or replicate virtual machine to an offsite recovery site.

Changing IP on machines one by one is very difficult on more than one machine and it be tougher.

PowerCLI has cmdlet that it called “Invoke-VMScript”, the cmdlet lets you to run scripts on guest OS even when guest OS has no IP. But VMware Tools must be installed and also updated VMware Tools is recommended.

Also you must have guest OS credential to run your script.

Sample Script

Here is a sample script to change IP address on multiple VM and also change NFS mount point IP addresses on “fstab” file.

Before run, you must customize the below script and put proper network configuration file within the script:

Read More on Teimouri.Net:

Add existing virtual desktops to “Automated Pool” in VMware View manually

[PowerCLI]: Change Local Account Password on ESXi

[Script]: Find ESXi HBA WWN via PowerCLI

Veeam Backup & Replication – Re-IP Rule on Linux VM

Davoud Teimouri

Davoud Teimouri is as a professional blogger, vExpert 2015/2016/2017/2018/2019, VCA, MCITP. This blog is started with simple posts and now, it has large following readers.

3 Responses

  1. darwa says:

    Typo (“Credntial”) in code.

  1. 27/05/2019

    […] [How To]: Change Linux IP Address via PowerCLI […]

Leave a Reply

Your email address will not be published. Required fields are marked *