Condividi tramite


Move-SCVirtualHardDisk

Move-SCVirtualHardDisk

Moves a virtual hard disk file from one location to another on the same host or to a location on a different host.

Syntax

Parameter Set: MoveVHDOnIDE
Move-SCVirtualHardDisk -Bus <Byte> -IDE -JobGroup <Guid]> -LUN <Byte> -Path <String> [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: MoveVHDOnSCSI
Move-SCVirtualHardDisk -Bus <Byte> -JobGroup <Guid]> -LUN <Byte> -Path <String> -SCSI [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: SetVM
Move-SCVirtualHardDisk [-VirtualHardDisk] <StandaloneVirtualHardDisk> -Path <String> [-JobGroup <Guid]> ] [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [ <CommonParameters>]

Detailed Description

The Move-SCVirtualHardDisk cmdlet moves a Windows-based virtual hard disk file (a .vhd file) or a VMware-based virtual hard disk file (a .vmdk file) from one location to another on the same host. You can also use Move-SCVirtualHardDisk with the Move-SCVirtualMachine cmdlet to move a virtual hard disk file to a location on a different host.

You can use this cmdlet to perform the following tasks:

-- Move a virtual hard disk on a running VMware virtual machine with no service interruption.
-- Move a virtual hard disk on a running Windows Server 2008 R2 or Windows Server 2012 virtual machine with minimal service interruption. In this case, use Move-SCVirtualHardDisk with Move-SCVirtualMachine.
-- Move a virtual hard disk on a virtual machine on any type of host if the virtual machine is in a stopped state or in a saved state. In this case, use Move-SCVirtualHardDisk with Set-SCVirtualMachine. This option is supported if either of the following conditions are true:
-- The virtual machine is on a host that uses Windows Server 2008 R2 or Windows Server 2012 Hyper-V technology or on a VMware ESX host, and the virtual machine is in a saved state or in a stopped state.
-- The virtual machine is on any other supported host, and it is in a stopped state.

Usage examples:

-- If a host has multiple physical disk drives and the virtual machine has two virtual hard disks (one disk might contain the operating system and the other disk might contain data), you can use this cmdlet to move one of the virtual hard disks to a different physical hard drive in order to improve performance for both virtual hard disks.
-- If the virtual machine has one dynamically expanding virtual hard disk and you discover that the virtual hard disk has expanded to a point where it uses most of the space on its current physical hard disk on the host, you can use this cmdlet to move the expanded virtual hard disk to a larger physical hard disk if one is available on the host.

Parameters

-Bus<Byte>

Specifies the IDE bus to which to attach a virtual disk drive or virtual DVD drive, or the SCSI bus to which to attach a virtual disk drive.

Example format: -IDE -Bus 1 -LUN 0

Example format: -SCSI -Bus 0 -LUN 1

NOTE: See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IDE

Specifies IDE as the bus type to which to attach a virtual disk drive object or a virtual DVD drive object configured on a virtual machine or on a template.

Example format: -IDE -Bus 0 -LUN 1

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-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?

true

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

-LUN<Byte>

Specifies the logical unit number (LUN) for a virtual disk drive object or for a virtual DVD drive object on an IDE bus, or for a virtual disk drive object on a SCSI bus.

Example format: -IDE -Bus 1 -LUN 0

Example format: -SCSI -Bus 0 -LUN 1

Aliases

none

Required?

true

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?

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

-SCSI

Specifies SCSI as the bus type to which to attach a virtual disk drive object configured on a virtual machine or on a template.

Example format: -SCSI -Bus 0 -LUN 0

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VirtualHardDisk<StandaloneVirtualHardDisk>

Specifies a virtual hard disk object.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

Aliases

none

Required?

false

Position?

named

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.

  • VirtualHardDisk

Examples

Example 1: Move a virtual hard disk file from one location to another on the same host

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

The second command stores the first virtual hard disk object on VM01 in the $VHD variable.

The last command moves the virtual hard disk stored in $VHD to the existing folder C:\VHDs.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> $VHD = $VM.VirtualHardDisks[0]
PS C:\> Move-SCVirtualHardDisk -VirtualHardDisk $VHD -Path "C:\VHDs"

Compress-SCVirtualDiskDrive

Copy-SCVirtualHardDisk

Get-SCVirtualHardDisk

Move-SCVirtualMachine

Remove-SCVirtualHardDisk

Set-SCVirtualHardDisk

Get-SCVirtualMachine

Set-SCVirtualMachine