Create a Virtual Machine with a Network Serial Port

You can use the CreateVM_Task method to create a virtual machine and configure a network serial port. The virtual machine uses the virtual serial port configuration to connect to a proxy and to accept a connection from a remote system.

Procedure

  1. Create a VirtualMachineConfigSpec object for the method's config parameter.
  2. Create a VirtualDeviceConfigSpec object for the deviceChange array in the VirtualMachineConfigSpec object.
  3. Create a VirtualSerialPort object for the device property in the VirtualDeviceConfigSpec object.
  4. To control proxy connection behavior, create a VirtualDeviceConnectInfo data object for the VirtualSerialPort.connectable property.

    The following pseudocode shows the resulting path to the connection information.

    VirtualMachineConfigSpec.deviceChange[].device.connectable
  5. Set the startConnected property in the connectable object to TRUE.

    The startConnected property determines whether the virtual machine will open a connection with the proxy when the virtual machine starts. When the virtual machine powers on, it copies the startConnected value to the VirtualDeviceConnectInfo.connected property. While the virtual machine is running, you can use the ReconfigVM_Task method to set the connected property to open or close the proxy connection. If you reconfigure a port with connected set to TRUE, the virtual machine closes the existing connection and opens a new one.

  6. Create a VirtualDeviceURIBackingInfo object for the backing property in the VirtualSerialPort object.

    The following pseudocode shows the resulting path to the backing information.

    VirtualMachineConfigSpec.deviceChange[].device.backing

    Use the backing information object to supply the following information:

    • Set the direction property to “server” to direct the virtual machine to accept remote connections.
    • Set the serviceURI property to the URI for the host on which the virtual machine runs.
    • Set the proxyURI property to the URI for the virtual serial port concentrator. You cannot include a user/password sequence in the proxy URI.