Share via


Save-SCVirtualMachine

Save-SCVirtualMachine

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

Syntax

Parameter Set: Default
Save-SCVirtualMachine [-VM] <VM> [-JobVariable <String> ] [-LibraryServer <LibraryServer> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-SharePath <String> ] [-UseLAN] [ <CommonParameters>]

Detailed Description

The Save-SCVirtualMachine cmdlet migrates a virtual machine deployed on a host to the 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, Virtual Machine Manager (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.

Parameters

-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

-LibraryServer<LibraryServer>

Specifies a VMM library server object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-OnBehalfOfUser<System.String>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUserRole<Microsoft.SystemCenter.VirtualMachineManager.UserRole>

Aliases

none

Required?

false

Position?

named

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

-SharePath<String>

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"

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UseLAN

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VM>

Specifies a virtual machine object.

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

Notes

  • This cmdlet requires a VMM virtual machine object, which can be retrieved by using the Get-SCVirtualMachine cmdlet.

Examples

Example 1: Save a virtual machine to the library

The first command gets the virtual machine object named VM01, and then stores the object in the $VM variable.

The second command gets the library server object named LibServer01, and then 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.

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"

Example 2: Store a virtual machine in the library asynchronously

The first command gets the virtual machine object named VM02, and then stores the object in the $VM variable.

The second command gets the library server object named LibServer02, and then 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.

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

Example Example 3: Store a virtual machine in the library by forcing a network transfer.

The first command gets the virtual machine object named VM03, and then stores the object in the $VM variable.

The second command gets the library server object named LibServer01, and then 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.

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

Get-SCVirtualMachine

Move-SCVirtualMachine

Read-SCVirtualMachine

Stop-SCVirtualMachine

Get-SCLibraryServer