I am trying to rename multiple virtualmachines(Poweredoff) in a cluster by unregistering and reregistering with a new name but in order to change vmx,vmdk,any snapshot file and vmfoldername to the newly changed name (vsphere display) I need to do storage vmotion.
Here are the few challenges while this activity:
1. Bulk migrations to different luns taking time.
2.Low storage space. (If the vm size is more then the free space available in other datastores I need to spread vmdks across multiple datastores.
Is there any better way to perform this activity please suggest.
My thought is like (get the virtual machine folder before unregistering the vm and keep that in a variable and rename all the vm related files to newname along with the folder and register back to the cluster)
It's a bit more complicated than that I'm afraid.
You will, for example, also need to update the content of the VMX file.
As an example, have a look at my HL Tools – Part 1 – Clone A VM Without VCenter post, where I do all the required actions from a script.
You could update that script to copy instead of clone.
But why not let SDRS do the work for you?
- makes sure SDRS is set to fully automated
- make sure there is no VMDK affinity (VMDK for a VM do not need to be kept together)
- rename all the VMs you need to rename
- place the datastores , one by one, in and out of maintenance, that way SDRS will do the moving for you
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It's a bit more complicated than that I'm afraid.
You will, for example, also need to update the content of the VMX file.
As an example, have a look at my HL Tools – Part 1 – Clone A VM Without VCenter post, where I do all the required actions from a script.
You could update that script to copy instead of clone.
But why not let SDRS do the work for you?
- makes sure SDRS is set to fully automated
- make sure there is no VMDK affinity (VMDK for a VM do not need to be kept together)
- rename all the VMs you need to rename
- place the datastores , one by one, in and out of maintenance, that way SDRS will do the moving for you
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Good Idea I will go with SDRS. If facing any challenges will post you back
Thanks LucD you are always helpful