Share via


IVMVirtualMachine::Name property

The Name property contains the name of the virtual machine configuration.

This property is read/write.

Syntax

HRESULT put_Name(
  [in]  BSTR virtualMachineName
);

HRESULT get_Name(
  [out] BSTR *virtualMachineName
);

VB
VMVirtualMachine.Name( _
  ByRef virtualMachineName, _
  ByVal virtualMachineName _
)

Property value

The name of the virtual machine configuration. The total length of the fully qualified path that includes the virtual machine name configuration file cannot be more than 256 characters.

This property value is read/write.

Error codes

Name Meaning
S_OK
The operation was successful.
E_POINTER
The virtualMachineName parameter is NULL.
E_INVALIDARG
The virtualMachineName parameter is not valid or is an empty string.
VM_E_VM_UNKNOWN
Unknown configuration.
VM_E_CONFIG_NAME_TOO_LONG
virtualMachineName contains too many characters.
VM_E_CONFIG_NAME_INVALID_CHAR
virtualMachineName contains one of the following invalid characters "*?:<>/|\"".
VM_E_CONFIG_DUPLICATE_NAME
virtualMachineName already exists as a name of another virtual machine.
DISP_E_EXCEPTION
An unexpected error has occurred.

Remarks

Virtual machine names are case-insensitive, e.g. "MyVM" and "myvm" refer to the same virtual machine. This is the default property for IVMVirtualMachine.

Due to the method in which links to a ".vmc" configuration file are maintained by Virtual Server, the effective maximum length of a virtual machine name is roughly 150 characters. The actual usable maximum length will vary for each system.

Examples

The following example displays the Name property value of a VMVirtualMachine object.

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows Server 2003")

Wscript.Echo "VM Name: " & objVM.Name

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IVMVirtualMachine