Re-Customize Existing Virtual Machine

We had to move some our Linux servers from our primary site to another during past days and we had network problem on them.

As the machines MAC addresses had been changed after restoring them to another vCenter, the machines network configurations were incorrect.

We didn’t have the machines root password and we couldn’t re-configure network configuration files in the machines.

Don’t worry about the same situation, if you had customize your machine by a “Customization Specification” in vCenter and you didn’t change other network configuration files such as hosts file and others, you can re-customize the machine without having root password and also do it automatically.

The solution is: PowerCLI script!

At the first step, you have to customize network mapping of your customization specification:

Get-OSCustomizationSpec -Name $OSSpec | `
Get-OSCustomizationNicMapping | `
Set-OSCustomizationNicMapping -IpMode:UseStaticIP -IpAddress $IP -SubnetMask $Mask -DefaultGateway $Gateway

You must replace network specifications in the above script.

At the second step, you have to shutdown your machine and then run the below command:

Get-VM -Name $VMName| Set-VM -OSCustomizationSpec $OSSpec

Power on your machine and the customization will be applied on your machine again.

[quotes_and_tips]

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.

Leave a Reply

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