Register-SCVirtualMachine
Register-SCVirtualMachine
Registers an existing virtual machine with VMM.
Syntax
Parameter Set: Default
Register-SCVirtualMachine [-Path] <String> [-VMHost] <Host> [-JobGroup <Guid]> ] [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [ <CommonParameters>]
Detailed Description
The Register-SCVirtualMachine cmdlet registers an existing virtual machine with 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.
Parameters
-JobGroup<Guid]>
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-JobVariable<String>
Specifies that job progress is tracked and stored in the variable named by this parameter.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Path<String>
Specifies the destination path for the operation.
Example formats:
Local: -Path "F:\"
UNC: -Path "\\Library\Templates"
Volume GUID: -Path "\\?\Volume{4703c1ea-8ae7-11db-b473-00123f7603e3}\"
VMware ESX: -Path "[storage1]\MyVMwareFolderForVMs\MyVM.vmx"
Citrix XenServer: -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 "\\VMHostServer\MyVMs\*VM*"
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PROTipID<Guid]>
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-RunAsynchronously
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VMHost<Host>
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.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- VirtualMachine
Examples
Example 1: Register an existing virtual machine on a Hyper-V host
The first command gets the Hyper-V host object named HVHost02, and then 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.
PS C:\> $VMHost = Get-SCVMHost -ComputerName "HyperVHost01"
PS C:\> Register-SCVirtualMachine -VMHost $VMHost -Path "D:\HyperVFolderForVMs"
Example 2: Register an existing virtual machine on a VMware ESX host
The first command gets the object that represents a VMware ESX host called ESXHost03, and then stores the host object in the $VMHost variable.
The second 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.
PS C:\> $VMHost = Get-VMHost -ComputerName "ESXHost03"
PS C:\> Register-SCVirtualMachine -VMHost $VMHost -Path "[storage1]\VMwareFolderForVMs\MyVM.vmx"