Save-SCVirtualMachine

Migrates a virtual machine deployed on a host to the VMM library.

Description

The Save-SCVirtualMachine cmdlet migrates a virtual machine deployed on a host to the System Center Virtual Machine Manager (VMM) library.

The Save-SCVirtualMachine cmdlet lets you store a virtual machine to the VMM library by using one of the following transfer methods:

- SAN TRANSFER (Fibre Channel, iSCSI, or NPIV) - If the host and library 
  server are both connected to SAN storage, VMM can use a SAN transfer to
  store the virtual machine in the library. In a SAN transfer, the target 
  LUNs are remapped from the source host to the destination library 
  server. No files are moved, which is why a SAN transfer is much faster 
  than moving virtual machine  files from one host to another over a 
  local area network (LAN). VMM can use an NPIV SAN transfer if a host 
  bus adapter (HBA) with NPIV support is available. 

- NETWORK TRANSFER - If no faster method is available, VMM uses a 
  network transfer to move the virtual machine files from the host server 
  to the library server over the LAN that connects the two servers. You 
  must use the -SharePath parameter to specify the path to the share in 
  the library where you want to store the virtual machine.

Save-SCVirtualMachine automatically uses the fastest available transfer type. If you want to force a network transfer, you can use the UseLAN parameter. If the host server and library server are the same server, the command will not fail if you specify the UseLAN parameter, but the migration to the library will occur faster if you do not use that parameter.

When a virtual machine is stored in the library, it cannot be started. Before you can start the virtual machine, you must use the Move-SCVirtualMachine cmdlet to deploy it from the library to a host.

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

Parameters

VM

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a virtual machine object.

LibraryServer

Required? true
Accept Pipeline Input? true (ByValue)
Position? named
Specifies a VMM library server object.

SharePath

Required? true
Accept Pipeline Input? false
Position? named
Specifies a path to a valid library share on an existing library server that uses a Universal Naming Convention (UNC) path. 

Example format: –SharePath "\\LibServer01\LibShare"

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. 

UseLAN

Required? false
Accept Pipeline Input? false
Position? named
Forces a transfer over the local area network (LAN) even if a faster transfer mechanism, such as a storage area network (SAN) transfer, is available.
Requires a VMM virtual machine object, which can be retrieved by using the Get-SCVirtualMachine cmdlet.

Examples

1: Save a virtual machine to the library.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> $LibServer = Get-SCLibraryServer -ComputerName "LibServer01"
PS C:\> Save-SCVirtualMachine -LibraryServer $LibServer -VM $VM -SharePath "\\LibServer01.Contoso.com\Library01\VMs"
The first command gets the virtual machine object named VM01 and stores the object in the $VM variable.

The second command gets the library server object named LibServer01 and stores the object in the $Library variable.

The last command migrates VM01 from its host and stores it to the location \\LibServer01.Contoso.com\Library01\VMs. The command automatically uses the fastest available transfer type.
2: Store a virtual machine in the library asynchronously.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM02"
PS C:\> $LibServer = Get-SCLibraryServer -ComputerName "LibServer02"
PS C:\> Save-SCVirtualMachine -LibraryServer $LibServer -VM $VM -SharePath "\\LibServer02.Contoso.com\Library02\VMs" -RunAsynchronously -JobVariable "SaveVMJob"
PS C:\> $SaveVMJob
The first command gets the virtual machine object named VM02 and stores the object in the $VM variable.

The second command gets the library server object named LibServer02 and stores the object in the $Library variable.

The third command migrates VM02 to the location \\LibServer02.Contoso.com\Library02\VMs. The RunAsynchronously parameter returns control to the command shell immediately and the JobVariable parameter tracks job progress and stores a record of its progress in SaveVMJob. For JobVariable, you do not use the dollar sign ($) when the variable is created.

The last command displays the contents of $SaveVMJob.
3: Store a virtual machine in the library by forcing a network transfer.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM03"
PS C:\> $LibServer = Get-SCLibraryServer -ComputerName "LibServer01"
PS C:\> Save-SCVirtualMachine -LibraryServer $LibServer -VM $VM -SharePath "\\LibServer01.Contoso.com\Library01\VMs" -UseLAN
The first command gets the virtual machine object named VM03 and stores the object in the $VM variable.

The second command gets the library server object named LibServer01 and stores the object in the $LibServer variable.

The last command stores VM03 to the location \\LibServer01.Contoso.com\Library01\VMs. The UseLAN parameter forces a network transfer over the LAN even if a faster transfer mechanism is available.

See Also