Add-VMDvdDrive

Add-VMDvdDrive

Adds a DVD drive to a virtual machine.

Syntax

Parameter Set: VMName
Add-VMDvdDrive [-VMName] <String[]> [[-ControllerNumber] <Int32> ] [[-ControllerLocation] <Int32> ] [[-Path] <String> ] [-AllowUnverifiedPaths] [-ComputerName <String[]> ] [-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>]

Detailed Description

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

Parameters

-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.

Aliases

none

Required?

false

Position?

named

Default Value

.

Accept Pipeline Input?

false

Accept Wildcard Characters?

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.

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

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.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Passthru

Passes the added Microsoft.Virtualization.Powershell.DvdDrive through to the pipeline.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Path<String>

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

Aliases

none

Required?

false

Position?

5

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ResourcePoolName<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VirtualMachine[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMDriveController<VMDriveController[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMName<String[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

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

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Virtualization.Powershell.DvdDrive

Examples

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:\