Add-VMDvdDrive

Add-VMDvdDrive

Adds a DVD drive to a virtual machine.

语法

Parameter Set: VMName
Add-VMDvdDrive [-VMName] <String[]> [[-ControllerNumber] <Int32]> ] [[-ControllerLocation] <Int32]> ] [[-Path] <String> ] [-AllowUnverifiedPaths] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-Passthru] [-ResourcePoolName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMDriveController
Add-VMDvdDrive [-VMDriveController] <VMDriveController[]> [[-ControllerLocation] <Int32]> ] [[-Path] <String> ] [-AllowUnverifiedPaths] [-Passthru] [-ResourcePoolName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject
Add-VMDvdDrive [-VM] <VirtualMachine[]> [[-ControllerNumber] <Int32]> ] [[-ControllerLocation] <Int32]> ] [[-Path] <String> ] [-AllowUnverifiedPaths] [-Passthru] [-ResourcePoolName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

详细说明

The Add-VMDvdDrive cmdlet adds a DVD drive to a virtual machine.

参数

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

在远程会话中或远程计算机上运行该 cmdlet。输入计算机名或会话对象,如 New-cimsessionGet-cimsession cmdlet 的输出。默认为本地计算机上的当前会话。

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-ComputerName<String[]>

Specifies one or more Hyper-v hosts on which the DVD drive is to be added. 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

-ControllerLocation<Int32]>

Specifies the number of the location on the controller at which the DVD drive is to be added. If not specified, the number of the first available location on the controller is used.

别名

none

是否必需?

false

在哪里?

4

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-ControllerNumber<Int32]>

Specifies the number of the controller to which the DVD drive is to be added. If not specified, the first IDE controller on which the specified ControllerLocation is available is used.

别名

none

是否必需?

false

在哪里?

3

默认值

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

-Passthru

Passes the added Microsoft.HyperV.PowerShell.DvdDrive through to the pipeline.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-Path<String>

Specifies the full path to the virtual hard disk file or physical hard disk volume for the added DVD drive.

别名

none

是否必需?

false

在哪里?

5

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-ResourcePoolName<String>

Specifies the friendly name of the ISO resource pool to which this DVD drive is to be associated.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-VM<VirtualMachine[]>

Specifies the virtual machine to which the DVD drive is to be added.

别名

none

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue)

是否接受通配符?

false

-VMDriveController<VMDriveController[]>

Specifies the drive controller to which the DVD drive is to be added.

别名

none

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue)

是否接受通配符?

false

-VMName<String[]>

Specifies the name of the virtual machine to which the DVD drive is to be added.

别名

none

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue)

是否接受通配符?

false

-AllowUnverifiedPaths

Specifies that no error is to be thrown if the specified path is not verified as accessible by the cluster. This parameter is applicable to clustered virtual machines.

别名

none

是否必需?

false

在哪里?

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 的对象的类型。

  • Microsoft.HyperV.PowerShell.VMDriveController[]
  • Microsoft.HyperV.PowerShell.VirtualMachine[]

输出

输出类型是 cmdlet 发出的对象的类型。

  • Microsoft.HyperV.PowerShell.DvdDrive

示例

Example 1

This example adds a virtual DVD drive using file D:\ISOs\disc1.iso to virtual machine Test.

PS C:\> Add-VMDvdDrive -VMName Test –Path D:\ISOs\disc1.iso

Example 2

This example adds a virtual DVD drive using controller number 1 to virtual machine Test.

PS C:\> Get-VM Test | Add-VMDvdDrive -ControllerNumber 1

Example 3

This example adds virtual DVD drives using the IDE controllers from virtual machine Test.

PS C:\> Get-VMIdeController –VMName Test | Add-VMDvdDrive –Path E:\