Move-VMStorage
Move-VMStorage
Moves the storage of a virtual machine.
Syntax
Parameter Set: NameMultipleDestinations
Move-VMStorage [-VMName] <String> [-AllowUnverifiedPaths] [-AsJob] [-ComputerName <String[]> ] [-ResourcePoolName <String> ] [-RetainVhdCopiesOnSource] [-SmartPagingFilePath <String> ] [-SnapshotFilePath <String> ] [-Vhds <Hashtable[]> ] [-VirtualMachinePath <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: NameSingleDestination
Move-VMStorage [-VMName] <String> [-DestinationStoragePath] <String> [-AllowUnverifiedPaths] [-AsJob] [-ComputerName <String[]> ] [-ResourcePoolName <String> ] [-RetainVhdCopiesOnSource] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: VMMultipleDestinations
Move-VMStorage [-VM] <VirtualMachine> [-AllowUnverifiedPaths] [-AsJob] [-ResourcePoolName <String> ] [-RetainVhdCopiesOnSource] [-SmartPagingFilePath <String> ] [-SnapshotFilePath <String> ] [-Vhds <Hashtable[]> ] [-VirtualMachinePath <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: VMSingleDestination
Move-VMStorage [-VM] <VirtualMachine> [-DestinationStoragePath] <String> [-AllowUnverifiedPaths] [-AsJob] [-ResourcePoolName <String> ] [-RetainVhdCopiesOnSource] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Move-VMStorage cmdlet moves the storage of a virtual machine.
Parameters
-AsJob
Specifies that the cmdlet is to be run as a background job.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ResourcePoolName<String>
Specifies the name of the storage resource pool to use after the move operation is complete.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SnapshotFilePath<String>
Specifies the new path for any snapshot files associated with the virtual machine.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VM<VirtualMachine>
Specifies the virtual machine whose storage is to be moved.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-VMName<String>
Specifies the name of the virtual machine whose storage is to be moved.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-VirtualMachinePath<String>
Specifies the path to the virtual machine configuration file and associated memory files.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-AllowUnverifiedPaths
Allows the move operation to be attempted even if the paths specified for the destination computer cannot be verified prior to attempting the move operation.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-DestinationStoragePath<String>
Specifies a destination storage path to which all virtual machine storage is to be moved.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-RetainVhdCopiesOnSource
Specify $true to keep any parent virtual hard disks on the source computer. If not specified, all virtual hard disks will be removed from the source computer once the virtual machine is successfully moved.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SmartPagingFilePath<String>
Specifies the new path to use for a smart paging file, if one is needed.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Vhds<Hashtable[]>
Specifies an array of hashtables that contain locations for each individual virtual hard disk to be moved. Each hashtable should have two entries. The first entry specifies the current location of the virtual hard disk to move, and has a key of SourceFilePath. The second entry specifies the new location for the virtual hard disk, and has a key of DestinationFilePath. The virtual hard disk name must be identical in both entries.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ComputerName<String[]>
Specifies one or more virtual machine hosts on which the virtual machine storage is to be moved. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer — use “localhost” or a dot (“.”) to specify the local computer explicitly.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
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.
Examples
Example 1
Moves all files associated with a virtual machine test VM to D:\TestVM
PS C:\> Move-VMStorage “Test VM” –DestinationStoragePath D:\TestVM
Example 2
Moves all files associated with a virtual machine test VM to different locations under D:\TestVM.
PS C:\> Move-VMStorage “Test VM” –VirtualMachinePath D:\TestVM\Config –SnapshotFilePath D:\TestVM\Snapshots –SmartPagingFilePath D:\TestVM\SmartPaging –VHDs @(@{“SourceFilePath” = “C:\TestVM\Disk1.VHDX”; “DestinationFilePath” = “D:\TestVM\Disks\Disk1.VHDX”}, @{“SourceFilePath” = “C:\TestVM\Disk2.VHDX”; “DestinationFilePath” = “D:\TestVM\Disks\Disk2.VHDX”})