Register-SCVirtualMachine

Registers an existing virtual machine with VMM that is currently not registered with the virtualization platform of any host managed by VMM and is not stored in the VMM library.

Description

The Register-SCVirtualMachine cmdlet registers an existing virtual machine with System Center Virtual Machine Manager (VMM) that is not currently registered with the virtualization platform (Hyper-V, VMware, or XenServer) of any host managed by VMM, and is not stored in the VMM library. If virtual machine files are stored in the VMM library, you do not need to register the virtual machine before you deploy it on a host.

The configuration files for the virtual machine that you want to register must be stored either in the file system on the host on which you want to deploy the virtual machine or stored on shared storage (such as a SAN) available to this host:

- HYPER-V HOST – You can register a virtual machine for a Hyper-V host
  if the configuration files for that virtual machine are stored in a 
  folder on the host's file system or on shared storage, and an export
  of the virtual machine was created using the "Export" function in the
  Hyper-V Manager console. 

  The path must specify a folder. Example: -Path "D:\HyperVFolderForVMs"

- VMWARE ESX HOST - You can register a virtual machine for a VMware ESX
  host if the VMware virtual machine configuration file (a .vmx file)
  is stored on the host's file system or on shared storage. No separate
  "export" step is required.

  The path must specify the folder and the configuration file. Example: -Path [Datastore]\VMwareFolderForVMs\VM.vmx

- CITRIX XENSERVER HOST - This command does not apply to virtual
  machines on a XenServer host.

For more information about Register-SCVirtualMachine, type: "Get-Help Register-SCVirtualMachine -online".

Parameters

VMHost

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a virtual machine host object. VMM supports Hyper-V hosts, VMware ESX hosts, and Citrix XenServer hosts. 

For more information about each type of host, type: "Get-Help Add-SCVMHost -detailed". See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

Path

Required? true
Accept Pipeline Input? false
Position? 0
Specifies the destination path for the operation.

Example formats:
 Local path	 -Path "F:\"
 UNC path		 -Path "\\Library\Templates"
 Volume GUID path -Path "\\?\Volume{4703c1ea-8ae7-11db-b473-00123f7603e3}\"
 VMware ESX path  –Path "[storage1]\MyVMwareFolderForVMs\MyVM.vmx"
 Citrix XenServer path - Path “Local storage[99b6212f-b63d-c676-25f9-d6c460992de7]”

Wildcards are supported for "Get" cmdlets and when you specify the UNC path:

Example format:
 UNC path		 -Path "\\VMHostServer\MyVMs\*VM*"

JobGroup

Required? false
Accept Pipeline Input? false
Position? named
Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs. 

JobVariable

Required? false
Accept Pipeline Input? false
Position? named
Specifies that job progress is tracked and stored in the variable named by this parameter. 

PROTipID

Required? false
Accept Pipeline Input? false
Position? named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

RunAsynchronously

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the job runs asynchronously so that control returns to the command shell immediately. 

Examples

1: Register an existing virtual machine on a Hyper-V host.
PS C:\> $VMHost = Get-SCVMHost -ComputerName "HyperVHost01"
PS C:\> Register-SCVirtualMachine –VMHost $VMHost –Path “D:\HyperVFolderForVMs”
The firstcommand gets the Hyper-V host object named HVHost02 and stores the object in the $VMHost variable.

The second command adds the existing virtual machine on HVHost02 to VMM by specifying the path to the folder that contains the virtual machine configuration file.
2: Register an existing virtual machine on a VMware ESX host.
PS C:\> $VMHost = Get-VMHost -ComputerName "ESXHost03" 
PS C:\> Register-VM –VMHost $VMHost –Path "[storage1]\VMwareFolderForVMs\MyVM.vmx"
The first command gets the object that represents a VMware ESX host called ESXHost03 and stores the host object in $VMHost. 

The last command adds an existing virtual machine on ESXHost03 to VMM by specifying the path to the virtual machine's virtual machine configuration file (MyVM.vmx).

See Also