Converts an existing virtual hard disk attached to a virtual disk drive object from dynamic to fixed or from fixed to dynamic, or converts a pass-through disk attached to a virtual disk drive object to a virtual hard disk.
Description
The Convert-SCVirtualDiskDrive cmdlet converts an existing virtual hard disk attached to a virtual disk drive object from dynamic to fixed or from fixed to dynamic, or converts a pass-through disk attached to a virtual disk drive object to a virtual hard disk.
CONVERTING A VIRTUAL HARD DISK FROM DYNAMIC TO FIXED, OR VICE VERSA
----------------------------------------------------------------
To convert the virtual hard disk from one format to the other, the virtual machine on which the virtual hard disk is configured must be in a stopped state.
You can only convert the disk format of a Windows-based virtual hard disk file (a .vhd file) on a virtual machine deployed on a Hyper-V host.
A VMware-based virtual hard disk file (a .vmdk file) on a virtual machine that is deployed on an ESX host is fixed in format and therefore cannot be converted to a dynamic format.
A Citrix XenServer-based virtual hard disk file (a .vhd file) on a virtual machine that is deployed on a Citrix XenServer host is also fixed in format and therefore cannot be converted to a dynamic format.
CONVERTING A PASS-THROUGH DISK TO A VIRTUAL HARD DISK
--------------------------------------------------
A pass-through disk is a physical hard disk on the host that a virtual machine can use instead of using a virtual hard disk. You can use Convert-SCVirtualDiskDrive to convert a pass-through disk attached to a virtual disk drive on a virtual machine to a virtual hard disk. The virtual machine must be on a Hyper-V host, and must be in a stopped state before you can convert the pass-through disk to a virtual hard disk.
For more information about Convert-SCVirtualDiskDrive, type: "Get-Help Convert-SCVirtualDiskDrive -online".
Parameters
VirtualDiskDrive
Required?
true
Accept Pipeline Input?
true (ByValue)
Position?
0
Specifies a virtual disk drive object. You can attach either a virtual hard disk (for a virtual machine on any host) or a pass-through disk (for a virtual machine on a Hyper-V host or an ESX host) to a virtual disk drive object.
Dynamic
Required?
true
Accept Pipeline Input?
false
Position?
named
Specifies that a virtual hard disk can expand dynamically.
FileName
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the file name to use when you rename a virtual hard disk file as you add it to a virtual machine.
JobGroup
Required?
false
Accept Pipeline Input?
false
Position?
named
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.
JobVariable
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies that job progress is tracked and stored in the variable named by this parameter.
Path
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the destination path for the operation.
Example formats:
Local path -Path "F:\"
UNC path -Path "\\Library\Templates"
Volume GUID path -Path "\\?\Volume{4703c1ea-8ae7-11db-b473-00123f7603e3}\"
VMware ESX path –Path "[storage1]\MyVMwareFolderForVMs\MyVM.vmx"
Citrix XenServer path - 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 -Path "\\VMHostServer\MyVMs\*VM*"
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.
VirtualDiskDrive
Required?
true
Accept Pipeline Input?
true (ByValue)
Position?
0
Specifies a virtual disk drive object. You can attach either a virtual hard disk (for a virtual machine on any host) or a pass-through disk (for a virtual machine on a Hyper-V host or an ESX host) to a virtual disk drive object.
Fixed
Required?
true
Accept Pipeline Input?
false
Position?
named
Specifies that a virtual hard disk is fixed in size.
FileName
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the file name to use when you rename a virtual hard disk file as you add it to a virtual machine.
JobGroup
Required?
false
Accept Pipeline Input?
false
Position?
named
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.
JobVariable
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies that job progress is tracked and stored in the variable named by this parameter.
Path
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the destination path for the operation.
Example formats:
Local path -Path "F:\"
UNC path -Path "\\Library\Templates"
Volume GUID path -Path "\\?\Volume{4703c1ea-8ae7-11db-b473-00123f7603e3}\"
VMware ESX path –Path "[storage1]\MyVMwareFolderForVMs\MyVM.vmx"
Citrix XenServer path - 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 -Path "\\VMHostServer\MyVMs\*VM*"
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.
Examples
1: Convert a pass-through disk on a
virtual disk drive on a virtual machine to a virtual hard
disk.
The first command gets the the virtual machine object named VM01 and stores the object in the $VM variable. This example assumes that VM01 is currently configured to use a pass-through disk and that the virtual machine has only one passthrough disk.
The second command gets the virtual disk drive object on VM01 and stores this object in the $VirtDiskDrive variable.
The last command converts the pass-through disk drive stored in $VirtDiskDrive to a fixed virtual hard disk and moves the virtual hard disk to the destination folder "C:\VirtualDiskDrives".
2: Convert one of several pass-through
disks on a virtual disk drive on a virtual machine to a virtual
hard disk.
The first command gets the virtual machine object named VM02 and stores the object in $VM. This example assumes that VM02 has three virtual disk drive objects and that the first virtual disk drive is bound to a virtual hard drive whereas both the second and third virtual disk drives are bound to pass-through disks.
The second command gets all virtual disk drive objects on VM02 and stores them in the $VirtDiskDrive object array.
The last command converts the third pass-through disk ($VirtDiskDrive [2]) to a dynamically expanding virtual hard disk and moves this new virtual hard disk to the destination folder "D:\".
3: Convert a dynamic VHD attached to a
virtual disk drive object on a virtual machine to a fixed
format.
The first command gets the virtual disk drive object that is attached to virtual machine VM03 and stores the virtual disk drive object in the $VirtDiskDrive variable. This example assumes that the virtual machine has only one virtual disk drive object and that the virtual hard disk attached to the virtual disk drive is a dynamic virtual hard disk.
The second command converts the virtual hard disk stored in $VirtDiskDrive to a fixed disk.