How to set Vagrants VM displayname in vmware_workstation

May 2024 ยท 1 minute read

I am trying to set the VM displayname in vmware via Vagrant:

Here is my Vagrantfile:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box" config.vm.provider :vmware_workstation do |vb| vb.name = "my_crazy_vm_name_rulezz" end end 

But the vmware Machine name still defaults to "vm: default"

What am I doing wrong?

1 Answer

Each provider is configured completely differently. What you're doing there is trying to use the VirtualBox's configuration .name to set something in VMWare, where there is no such "name" attribute. In VMWare there are only two things you can set (as far as I know), which are:

.gui = true/false # Enables/disables display of the VMWare GUI when you start this VM .vmx['key'] = 'value' # Sets a value in the .vmx file for this VM 

The .vmx configuration is what you're looking for, since it has a handy 'displayname' key. SO... here's the configuration you're looking for

config.vm.provider :vmware_workstation do |v| v.vmx['displayname'] = 'My Custom VM Name' end 

You can find other values you can configure this way by looking at the .vmx file for your VM in a text editor. This file can be found at: .vagrant/machines/default/vmware_workstation/{some_big_id}/{something}.vmx

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJoaW5pZGiBdn2OoaawZaSkerSx02atmp%2Bilru1v4yvpGacmai9ra3Yp5imnV2eu27CzLCYq51drLyzt9KtmK2hn6M%3D