HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Rename VM in VMware Fusion via command line

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
vmwarelineviacommandfusionrename

Problem

Is it possible to rename a VM in VMWare Fusion via command line? (ie not clone and then name the new VM and delete the old VM).

For example, Parallels has the prlctl tool, and the process would be something like:

prlctl stop oldname
prlctl set oldname --name newname
prlctl start newname

Solution

Well, there is no rename, it is a multi-step process, which involves renaming a bunch of entries inside the vmx file, using vmware-vdiskmanager to rename to vmdk and in general doing a bunch of potentially problematic actions if you don't know what you are doing.

You could probably write a quick Perl script to do all that using this guide.

Another option would be to clone it and delete the original, but it is resource intensive and does way too much work for what it is worth. The code below is untested:

vmrun -T fusion stop "/Volumes/vms/old/old.vmx"
vmrun -T fusion clone "/Volumes/vms/old/old.vmx" "/Volumes/vms/new/new.vmx" full --cloneName=new
vmrun -T fusion deleteVM "/Volumes/vms/old/old.vmx"
vmrun -T fusion start "/Volumes/vms/new/new.vmx"

Code Snippets

vmrun -T fusion stop "/Volumes/vms/old/old.vmx"
vmrun -T fusion clone "/Volumes/vms/old/old.vmx" "/Volumes/vms/new/new.vmx" full --cloneName=new
vmrun -T fusion deleteVM "/Volumes/vms/old/old.vmx"
vmrun -T fusion start "/Volumes/vms/new/new.vmx"

Context

StackExchange DevOps Q#2166, answer score: 3

Revisions (0)

No revisions yet.