2 Replies Latest reply on Aug 4, 2019 5:13 AM by continuum

    Create a VM via CLI.

    hack3rcon Enthusiast

      Hello,

      How can I create a VM by CLI?

       

      Thanks.

        • 2. Re: Create a VM via CLI.
          continuum Guru
          User ModeratorsCommunity WarriorsvExpert

          All you need is to echo a few lines into a vmx-file,

          create a vmdk with vmkfstools.

          register the VM with vom-cmd.

          Here is a very simple example ....

           

          mkdir /vmfs/volumes/datastore/test-vm

          cd /vmfs/volumes/datastore/test-vm

          echo  '.encoding = "UTF-8"'     > test-vm.vmx

          echo  'config.version = "8"'     >> test-vm.vmx

          echo  'virtualHW.version = "13"'     >> test-vm.vmx

          echo  'memSize = "512"'     >> test-vm.vmx

          echo  'scsi0.virtualDev = "lsilogic"'     >> test-vm.vmx

          echo  'scsi0.present = "TRUE"'     >> test-vm.vmx

          echo  'sata0.present = "TRUE"'     >> test-vm.vmx

          echo  'usb.present = "TRUE"'     >> test-vm.vmx

          echo  'ehci.present = "TRUE"'     >> test-vm.vmx

          echo  'scsi0:0.deviceType = "scsi-hardDisk"'     >> test-vm.vmx

          echo  'scsi0:0.fileName = "test-vm.vmdk"'     >> test-vm.vmx

          echo  'scsi0:0.present = "TRUE"'     >> test-vm.vmx

          echo  'ethernet0.virtualDev = "e1000e"'     >> test-vm.vmx

          echo  'ethernet0.networkName = "VM Network"'     >> test-vm.vmx

          echo  'ethernet0.addressType = "generated"'     >> test-vm.vmx

          echo  'ethernet0.present = "TRUE"'     >> test-vm.vmx

          echo  'sata0:0.deviceType = "atapi-cdrom"'     >> test-vm.vmx

          echo  'sata0:0.fileName = "/vmfs/devices/cdrom/mpx.vmhba64:C0:T0:L0"'     >> test-vm.vmx

          echo  'sata0:0.present = "TRUE"'     >> test-vm.vmx

          echo  'displayName = "test-vm"'     >> test-vm.vmx

          echo  'guestOS = "other-64"'     >> test-vm.vmx

           

          vmkfstools -c 2048m test-vm.vmdk

          vim-cmd solo/registervm /vmfs/volumes/datastore/test-vm/test-vm.vmx