New-VHD

New-VHD

Creates one or more new virtual hard disks.

구문

Parameter Set: DynamicWithoutSource
New-VHD [-Path] <String[]> [-SizeBytes] <UInt64> [-AsJob] [-BlockSizeBytes <UInt32> ] [-ComputerName <String[]> ] [-Dynamic] [-LogicalSectorSizeBytes <UInt32> ] [-PhysicalSectorSizeBytes <UInt32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: Differencing
New-VHD [-Path] <String[]> [-ParentPath] <String> [[-SizeBytes] <UInt64> ] [-AsJob] [-BlockSizeBytes <UInt32> ] [-ComputerName <String[]> ] [-Differencing] [-PhysicalSectorSizeBytes <UInt32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: DynamicWithSource
New-VHD [-Path] <String[]> -Dynamic -SourceDisk <UInt32> [-AsJob] [-BlockSizeBytes <UInt32> ] [-ComputerName <String[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: FixedWithoutSource
New-VHD [-Path] <String[]> [-SizeBytes] <UInt64> -Fixed [-AsJob] [-BlockSizeBytes <UInt32> ] [-ComputerName <String[]> ] [-LogicalSectorSizeBytes <UInt32> ] [-PhysicalSectorSizeBytes <UInt32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: FixedWithSource
New-VHD [-Path] <String[]> -Fixed -SourceDisk <UInt32> [-AsJob] [-BlockSizeBytes <UInt32> ] [-ComputerName <String[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

자세한 설명

The New-VHD cmdlet creates one or more new virtual hard disks in either VHD format or the newer VHDX format. The file extension you specify determines the format.

매개 변수

-AsJob

Runs the cmdlet as a background job.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-BlockSizeBytes<UInt32>

Specifies the block size, in bytes, of the virtual hard disk to be created.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which the virtual hard disk file(s) are to be created. 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.

별칭

없음

필수 여부

false

위치

named

기본값

.

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-LogicalSectorSizeBytes<UInt32>

Specifies the logical sector size, in bytes, of the virtual hard disk to be created. Valid values are 512 and 4096.

별칭

없음

필수 여부

false

위치

named

기본값

512

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-ParentPath<String>

Specifies the path to the parent of the differencing disk to be created (this parameter may be specified only for the creation of a differencing disk).

별칭

없음

필수 여부

true

위치

2

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Path<String[]>

Path to the new virtual hard disk file(s) that is being created as a result of a command. If a filename or relative path is specified, the new virtual hard disk path is calculated relative to the current working directory.

별칭

없음

필수 여부

true

위치

1

기본값

없음

파이프라인 입력 적용 여부

True (ByValue, ByPropertyName)

와일드카드 문자 허용 여부

false

-PhysicalSectorSizeBytes<UInt32>

Specifies the physical sector size, in bytes. Valid values are 512 and 4096.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-SizeBytes<UInt64>

The maximum size, in bytes, of the virtual hard disk to be created.

별칭

없음

필수 여부

true

위치

2

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-SourceDisk<UInt32>

Specifies the physical disk to be used as the source for the virtual hard disk to be created.

별칭

Number

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

True (ByPropertyName)

와일드카드 문자 허용 여부

false

-Differencing

Specifies that a differencing virtual hard disk is to be created.

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Dynamic

Specifies that a dynamic virtual hard disk is to be created.

별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Fixed

Specifies that a fixed virtual hard disk is to be created.

별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Confirm

cmdlet을 실행하기 전에 확인 메시지가 표시됩니다.

필수 여부

false

위치

named

기본값

false

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-WhatIf

cmdlet이 실행될 경우 결과 동작을 표시합니다. cmdlet이 실행되지 않습니다.

필수 여부

false

위치

named

기본값

false

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • VHDObject[]

예제

Example 1

This example creates a dynamic virtual hard disk in VHDX format that is 10 GB in size. The file extension determines the format and the default type of dynamic is used because no type is specified.

PS C:\> New-VHD –Path c:\Base.vhdx –SizeBytes 10GB

Example 2

This example creates a VHDX-format differencing virtual hard disk with a parent path of c:\Base.vhdx.

PS C:\> New-VHD –ParentPath c:\Base.vhdx –Path c:\Diff.vhdx -Differencing

Example 3

This example creates a 1 TB VHD-format fixed virtual hard disk at the specified path. The data for the virtual hard disk is populated from the disk identified in the system by the number 2. You can list the disks attached to the system and the number associated with each disk using the Get-Disk cmdlet.

PS C:\> New-VHD -Path C:\fixed.vhd –Fixed –SourceDisk 2 –SizeBytes 1TB

Example 4

This example creates a new 1 TB VHDX-format dynamic virtual hard disk at the specified path with a block size of 128 MB and a logical sector size of 4 KB.

PS C:\> New-VHD –Path c:\LargeSectorBlockSize.vhdx –BlockSizeBytes 128MB –LogicalSectorSize 4KB –SizeBytes 1TB

Example 5

This example creates a new 127GB VHD and then mounts, initializes, and formats it so the drive is ready to use.

PS C:\> $vhdpath = "C:\VHDs\Test.vhdx"
PS C:\> $vhdsize = 127GB
PS C:\> New-VHD -Path $vhdpath -Dynamic -SizeBytes $vhdsize | Mount-VHD -Passthru |Initialize-Disk -Passthru |New-Partition -AssignDriveLetter -UseMaximumSize |Format-Volume -FileSystem NTFS -Confirm:$false -Force