DrWho42
Contributor
Contributor

Command to create or convert shared VM

Jump to solution

I am using Workstation 10.0.5, and I'm trying to do what seems like a simple task, but I have been unable to find any documentation or discussions on how to do it.

I have a script which uses the ovftool to import an OVF, and then it uses vmrun -T ws to start the VM.  However, I would like to modify this either to create or convert the VM to be a shared VM, allowing it to auto-start without a user.  It is very simple to do through the UI:  Manage --> Share, but I want it to be hands-off for the user.

Any suggestions?

Thanks.

0 Kudos
1 Solution

Accepted Solutions
lkong
VMware Employee
VMware Employee

Welcome to VMware Workstation community!

The command "vmrun" can not create/convert the local VM to shared VM.

But there is another method to achieve to convert shared VM and auto-start it. The detailed steps as follows:

1. Copy your local VM to Shared VM Path, such as copy "c:\VMware\vm1\" to "c:\Users\Public\Documents\Shared Virtual Machines\".

2. Open the share vm config file "vmInventory.xml" in "c:\ProgramData\VMware\hostd" and add following lines to shared the vm(The red lines include your VM and VM's ID):

     <ConfigEntry id="0002">

           <objID>3</objID>

           <vmxCfgPath>C:\Users\Public\Documents\Shared Virtual Machines\VM1\VM1.vmx</vmxCfgPath>

     </ConfigEntry>

3. Open the shared VM config file "vmAutoStart.xml" in the same path and add/modify the following the lines to auto-start the shared VM, the object ID "3" should be same"

  <AutoStartOrder>

    <_length>1</_length>

    <_type>vim.host.AutoStartManager.AutoPowerInfo[]</_type>

    <e id="0">

      <_type>vim.host.AutoStartManager.AutoPowerInfo</_type>

      <key>

        <_type>vim.VirtualMachine</_type>

        <moid>3</moid>

      </key>

      <startAction>PowerOn</startAction>

      <startDelay>-1</startDelay>

      <startOrder>-1</startOrder>

      <stopAction>GuestShutdown</stopAction>

      <stopDelay>120</stopDelay>

      <waitForHeartbeat>systemDefault</waitForHeartbeat>

    </e>

  </AutoStartOrder>

4. Restart host and then lanch WS, the VM will be shared and auto-start.   

View solution in original post

0 Kudos
3 Replies
lkong
VMware Employee
VMware Employee

Welcome to VMware Workstation community!

The command "vmrun" can not create/convert the local VM to shared VM.

But there is another method to achieve to convert shared VM and auto-start it. The detailed steps as follows:

1. Copy your local VM to Shared VM Path, such as copy "c:\VMware\vm1\" to "c:\Users\Public\Documents\Shared Virtual Machines\".

2. Open the share vm config file "vmInventory.xml" in "c:\ProgramData\VMware\hostd" and add following lines to shared the vm(The red lines include your VM and VM's ID):

     <ConfigEntry id="0002">

           <objID>3</objID>

           <vmxCfgPath>C:\Users\Public\Documents\Shared Virtual Machines\VM1\VM1.vmx</vmxCfgPath>

     </ConfigEntry>

3. Open the shared VM config file "vmAutoStart.xml" in the same path and add/modify the following the lines to auto-start the shared VM, the object ID "3" should be same"

  <AutoStartOrder>

    <_length>1</_length>

    <_type>vim.host.AutoStartManager.AutoPowerInfo[]</_type>

    <e id="0">

      <_type>vim.host.AutoStartManager.AutoPowerInfo</_type>

      <key>

        <_type>vim.VirtualMachine</_type>

        <moid>3</moid>

      </key>

      <startAction>PowerOn</startAction>

      <startDelay>-1</startDelay>

      <startOrder>-1</startOrder>

      <stopAction>GuestShutdown</stopAction>

      <stopDelay>120</stopDelay>

      <waitForHeartbeat>systemDefault</waitForHeartbeat>

    </e>

  </AutoStartOrder>

4. Restart host and then lanch WS, the VM will be shared and auto-start.   

View solution in original post

0 Kudos
DrWho42
Contributor
Contributor

Thanks for the advice.  I'm trying to implement this, but I'm running into an issue.  We need to change the Shared VM Path to be on a larger partition.  I found the datastores.xml config file that changes whenever I manually change the path in the Preferences panel.  However, if I try to change this file via code, it will always revert back the first time I restart the hostd service.

Any thoughts on how I can change the default Shared VM path?

Thanks,

Keith

0 Kudos
DrWho42
Contributor
Contributor

Just to close this loop:  we ended up changing the default path when we deploy VM Workstation.

0 Kudos