Syntax
Set-HardDisk [-HardDisk] <HardDisk[]> [[-CapacityKB] <Int64>] [[-Persistence] <String>] [[-Datastore] <Datastore>] [-StorageFormat <VirtualDiskStorageFormat>] [-HostCredential <PSCredential>] [-HostUser <String>] [-HostPassword <SecureString>] [-GuestCredential <PSCredential>] [-GuestUser <String>] [-GuestPassword <SecureString>] [-ToolsWaitSecs <Int32>] [-HelperVM <VirtualMachine>] [-Partition <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Related Commands
Online versionDetailed Description
Changes the properties of the specified virtual hard disk. You can change the size and the persistence type, and inflate or expand the specified virtual hard disk. Do not use the Inflate parameter at the same time with the Persistence and CapacityKB parameters. If a helper virtual machine is used, all virtual machines associated with the disk and the helper virtual machine should be powered off before expanding the disk. When you resize more than one disks using a helper virtual machine, the disks are resized one by one causing the helper machine to power on and off for each virtual machine and this might slow the cmdlet performance. Consider that guest disk resizing functionality is experimental.Parameters
Return Type
HardDiskNotes
If you are connected to an ESX 3.0 host, the size of the disk cannot be cha nged and the CapacityKB parameter is discarded. If you are connected to an ESX 3.5 host, the size of the disk can only be increased and the CapacityKB parameter is discarded if its value is less than the current disk size. The Inflate parameter is supported only when connected to ESX 3.5 or later. On ESX versions higher than 3.0, non-persistent and undoable disks are not supported. Guest resizing is supported only on ESX 3.5 and later. Migrating a hard disk attached to a virtual machine to a different datastor e is supported only on vCenter Server.Examples
-------------- Example 1 --------------
Get-HardDisk -VM $vm | Set-HardDisk -Persistence "IndependentNonPersistent"
Changes the persistence of a hard disk to IndependentNonPersistent.
-------------- Example 2 --------------
Set-HardDisk -HardDisk $harddisk -CapacityKB $extendedCapacity -HostCredential $hostCred -GuestCredential $guestCred
Extends a hard disk with the specified capacity. The command also extends the disk on the guest OS.
-------------- Example 3 --------------
Set-HardDisk -HardDisk $harddisk -Datastore $datastore
Moves the hard disk to the specified datastore.