New-VM

New-VM

Creates a new virtual machine.

구문

Parameter Set: No VHD
New-VM [[-Name] <String> ] [[-MemoryStartupBytes] <Int64]> ] [[-Generation] <Int16]> {1 | 2} ] [-AsJob] [-BootDevice <BootDevice]> ] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-NoVHD] [-Path <String> ] [-SwitchName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: Existing VHD
New-VM [[-Name] <String> ] [[-MemoryStartupBytes] <Int64]> ] [[-Generation] <Int16]> {1 | 2} ] -VHDPath <String> [-AsJob] [-BootDevice <BootDevice]> ] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-Path <String> ] [-SwitchName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: New VHD
New-VM [[-Name] <String> ] [[-MemoryStartupBytes] <Int64]> ] [[-Generation] <Int16]> {1 | 2} ] -NewVHDPath <String> -NewVHDSizeBytes <UInt64> [-AsJob] [-BootDevice <BootDevice]> ] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-Path <String> ] [-SwitchName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

자세한 설명

The New-VM cmdlet creates a new virtual machine.

매개 변수

-AsJob

Runs the cmdlet as a background job.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-BootDevice<BootDevice]>

Specifies the device to use as the boot device for the new virtual machine. Allowed values are CD, Floppy, LegacyNetworkAdapter, IDE, NetworkAdapter, and VHD.

When LegacyNetworkAdapter is specified, this configures the new virtual machine with a network adapter that can be used to perform a PXE boot and install an operating system from a network installation server.

Note: Generation 2 virtual machines do not support Floppy, LegacyNetworkAdapter or IDE. Using these values with a Generation 2 virtual machine will cause an error.

VHD and NetworkAdapter are new to Generation 2 virtual machines. If you specify them on a Generation 1 virtual machine, then they are interpreted to be IDE and LegacyNetworkAdapter, respectively.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

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

원격 세션이나 원격 컴퓨터에서 cmdlet을 실행합니다. 컴퓨터 이름이나 New-CimSession 또는 Get-CimSession cmdlet의 출력과 같은 세션 개체를 입력하세요. 기본값은 로컬 컴퓨터 상의 현재 세션입니다.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which the virtual machine is 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.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

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.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-Generation<Int16]>

Specifies the generation, as an integer, for the virtual machine. The values that are valid in this version of Windows are 1 and 2.

별칭

none

필수 여부

false

위치

3

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-MemoryStartupBytes<Int64]>

Specifies the amount of memory, in bytes, to assign to the virtual machine. The default value is 512 MB.

별칭

none

필수 여부

false

위치

2

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-Name<String>

Specifies the name of the new virtual machine. The default name is New virtual machine.

별칭

VMName

필수 여부

false

위치

1

기본값

none

파이프라인 입력 허용 여부

True (ByValue, ByPropertyName)

와일드카드 문자 허용 여부

false

-NewVHDPath<String>

Creates a new virtual hard disk with the specified path and connects it to the new virtual machine. Absolute paths are allowed. If only a file name is specified, the virtual hard disk is created in the default path configured for the host.

별칭

none

필수 여부

true

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-NoVHD

Creates a virtual machine without attaching any virtual hard disks.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-Path<String>

Specifies the directory to store the files for the new virtual machine.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-SwitchName<String>

Specifies the friendly name of the virtual switch if you want to connect the new virtual machine to an existing virtual switch to provide connectivity to a network. Hyper-V automatically creates a virtual machine with one virtual network adapter, but connecting it to a virtual switch is optional.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-VHDPath<String>

Specifies the path to a virtual hard disk file.

별칭

none

필수 여부

true

위치

named

기본값

none

파이프라인 입력 허용 여부

false

와일드카드 문자 허용 여부

false

-NewVHDSizeBytes<UInt64>

Specifies the size of the dynamic virtual hard disk that is created and attached to the new virtual machine.

별칭

none

필수 여부

true

위치

named

기본값

none

파이프라인 입력 허용 여부

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 등의 일반 매개 변수를 지원합니다. 자세한 내용은 TechNet의 about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216)

입력

입력 형식은 cmdlet으로 파이프할 수 있는 개체의 형식입니다.

출력

출력 형식은 cmdlet 실행 시 출력되는 개체의 형식입니다.

  • Microsoft.HyperV.PowerShell.VirtualMachine

Example 1

This example creates a new virtual machine named new 1 that has 512 MB of memory.

PS C:\> New-VM –Name "new 1" –MemoryStartupBytes 512MB

Example 2

This example creates a virtual machine named new 2 that has 1 GB of memory and that is connected to a new 40 GB virtual hard disk that uses the VHDX format.

PS C:\> New-VM –Name "new 2" –MemoryStartupBytes 1GB –NewVHDPath d:\vhd\base.vhdx

Example 3

This example creates a virtual machine named new 3 that has 1 GB of memory and connects it to an existing virtual hard disk that uses the VHDX format.

PS C:\> New-VM –Name "new 3" –MemoryStartupBytes 1GB –VHDPath d:\vhd\BaseImage.vhdx