Resize-VHD

Resize-VHD

Resizes a virtual hard disk.

Syntax

Parameter Set: Size
Resize-VHD [-Path] <String[]> [-SizeBytes] <UInt64> [-AsJob] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: MinimumSize
Resize-VHD [-Path] <String[]> -ToMinimumSize [-AsJob] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detaillierte Beschreibung

The Resize-VHD cmdlet resizes a virtual hard disk. This cmdlet lets you shrink or expand the size of a virtual hard disk, but the shrink operation is allowed only on VHDX virtual hard disks. The shrink operation fails if it would shrink the virtual disk to less than its minimum size (available through the VHDX object’s MinimumSize property).

Resize-VHD is an offline operation; the virtual hard disk must not be attached when the operation is initiated.

Parameter

-AsJob

Runs the cmdlet as a background job.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-CimSession<Microsoft.Management.Infrastructure.CimSession[]>

Das Cmdlet wird in einer Remotesitzung oder auf einem Remotecomputer ausgeführt. Geben Sie einen Computernamen oder ein Sitzungsobjekt ein, wie z. B. die Ausgabe eines New-CimSession oder Get-CimSession-Cmdlets. Der Standardwert ist die aktuelle Sitzung auf dem lokalen Computer.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which a virtual hard disk is to be resized. 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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Credential<System.Management.Automation.PSCredential[]>

Specifies one or more user accounts that have permission to perform this action. The default is the current user.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Passthru

Specifies that an object is to be passed through to the pipeline representing the virtual hard disk to be resized.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Path<String[]>

Specifies the path to the virtual hard disk that is to be resized.

Aliase

FullName

Erforderlich?

true

Position?

1

Standardwert

none

Pipelineeingaben akzeptieren?

true (ByValue, ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-SizeBytes<UInt64>

Specifies the size to which the virtual hard disk is to be resized.

Aliase

none

Erforderlich?

true

Position?

2

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ToMinimumSize

Specifies that the virtual hard disk is to be resized to its minimum possible size.

Aliase

none

Erforderlich?

true

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Confirm

Fordert Sie vor der Ausführung des Cmdlet zum Bestätigen auf.

Erforderlich?

false

Position?

named

Standardwert

false

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-WhatIf

Zeit, was passieren würde, wenn das Cmdlet ausgeführt wird. Das Cmdlet wird nicht ausgeführt.

Erforderlich?

false

Position?

named

Standardwert

false

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

<CommonParameters>

Dieses Cmdlet unterstützt die allgemeinen Parameter: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer und -OutVariable. Weitere Informationen finden Sie unter about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Eingaben

Der Eingabetyp ist der Typ der Objekte, die Sie per Piping an das Cmdlet übergeben können.

Ausgaben

Der Ausgabetyp ist der Typ der Objekte, die vom Cmdlet ausgegeben werden.

Beispiele

Example 1

Expands the VHDX to 1 terabyte (assuming that the previous size was less than the new size prior to the command).

PS C:\> Resize-VHD –Path c:\BaseVHD.vhd –SizeBytes 1TB

Example 2

Shrinks the VHDX to one terabyte (assuming that the virtual hard disk object associated with the file path has a MinimumSize less than or equal to 1TB).

PS C:\> Resize-VHD –Path c:\BaseVHDX.vhdx –SizeBytes 1TB

Example 3

Shrinks the VHDX to its minimum possible size.

PS C:\> Resize-VHD –Path c:\BaseVHDX.vhdx –ToMinimumSize