編集

次の方法で共有


Add-VMDvdDrive

Adds a DVD drive to a virtual machine.

Syntax

Add-VMDvdDrive
   [-CimSession <CimSession[]>]
   [-ComputerName <String[]>]
   [-Credential <PSCredential[]>]
   [-VMName] <String[]>
   [[-ControllerNumber] <Int32>]
   [[-ControllerLocation] <Int32>]
   [[-Path] <String>]
   [-ResourcePoolName <String>]
   [-AllowUnverifiedPaths]
   [-Passthru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-VMDvdDrive
   [-VM] <VirtualMachine[]>
   [[-ControllerNumber] <Int32>]
   [[-ControllerLocation] <Int32>]
   [[-Path] <String>]
   [-ResourcePoolName <String>]
   [-AllowUnverifiedPaths]
   [-Passthru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-VMDvdDrive
   [-VMDriveController] <VMDriveController[]>
   [[-ControllerLocation] <Int32>]
   [[-Path] <String>]
   [-ResourcePoolName <String>]
   [-AllowUnverifiedPaths]
   [-Passthru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

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

Examples

Example 1

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

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

Example 2

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

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

Example 3

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

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

Parameters

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Type:CimSession[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputerName

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.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ControllerLocation

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.

Type:Int32
Position:3
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ControllerNumber

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.

Type:Int32
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

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

Type:PSCredential[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Passthru

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

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

Type:String
Position:4
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourcePoolName

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VM

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

Type:VirtualMachine[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMDriveController

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

Type:VMDriveController[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMName

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

Type:String[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.HyperV.PowerShell.VMDriveController[]

Microsoft.HyperV.PowerShell.VirtualMachine[]

Outputs

Microsoft.HyperV.PowerShell.DvdDrive