Set-SCVirtualDVDDrive

Changes properties of a virtual DVD drive associated with a virtual machine, virtual machine template, or hardware profile used in VMM.

Syntax

Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   [-VirtualDVDDrive] <VirtualDVDDrive>
   [-JobGroup <Guid>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   [-NoMedia]
   -JobGroup <Guid>
   -SourceBus <Byte>
   -SourceLUN <Byte>
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   [-VirtualDVDDrive] <VirtualDVDDrive>
   -VMHostDrive <String>
   [-JobGroup <Guid>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   [-VirtualDVDDrive] <VirtualDVDDrive>
   [-NoMedia]
   [-JobGroup <Guid>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   [-VirtualDVDDrive] <VirtualDVDDrive>
   [-JobGroup <Guid>]
   [-AnyVMHostDrive]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   [-Link]
   -ISO <ISO>
   -JobGroup <Guid>
   -SourceBus <Byte>
   -SourceLUN <Byte>
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   -VMHostDrive <String>
   -JobGroup <Guid>
   -SourceBus <Byte>
   -SourceLUN <Byte>
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   [-Link]
   [-VirtualDVDDrive] <VirtualDVDDrive>
   -ISO <ISO>
   [-JobGroup <Guid>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   -JobGroup <Guid>
   [-AnyVMHostDrive]
   -SourceBus <Byte>
   -SourceLUN <Byte>
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]
Set-SCVirtualDVDDrive
   [-Bus <Byte>]
   [-LUN <Byte>]
   -JobGroup <Guid>
   -SourceBus <Byte>
   -SourceLUN <Byte>
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [-OnBehalfOfUser <String>]
   [-OnBehalfOfUserRole <UserRole>]
   [<CommonParameters>]

Description

The Set-SCVirtualDVDDrive cmdlet changes one or more properties of a virtual DVD drive object associated with a virtual machine, virtual machine template, or hardware profile used in a Virtual Machine Manager (VMM) environment.

You can use this cmdlet to connect a virtual DVD drive to a physical DVD drive on a virtual machine host server, to a different location on the IDE bus, or to an ISO image, or you can use it to disconnect the virtual DVD drive.

Most settings that you can configure for a virtual DVD drive on a virtual machine are the same regardless of whether the virtualization platform of the host is Hyper-V, VMware, or Citrix XenServer. All of these virtualization platforms support the following:

  • Connecting a virtual DVD drive to a primary or secondary channel on a host.

  • Capturing information from a physical CD or DVD drive on the host without specifying a drive letter.

  • Capturing information from an image (ISO) file stored in the VMM library.

  • Capturing "no media" (used to disconnect a virtual DVD drive from the host drive or from an ISO file).

The only setting that varies for this cmdlet by virtualization platform is whether an ISO file can be used directly from the VMM library:

  • Hyper-V host. If you configure a connection to an ISO file in the VMM library, you can choose to use the ISO directly from the library instead of copying it to the host.

  • VMware ESX host. If you configure a connection to an ISO file in the VMM library, you cannot use the ISO directly from the library but must instead accept the default, which copies the ISO file to the host.

  • Citrix XenServer host. If you configure a connection to an ISO file in the VMM library, you cannot use the ISO directly from the library but must instead accept the default, which copies the ISO file to the host. The host must have at least one ISO repository available with write access and enough storage space to contain the ISO file.

Note: If the virtual DVD drive is configured on a virtual machine that was created by using the Virtual Machine wizard in the Hyper-V Manager Console rather than in the VMM console, you must specify a drive letter. That drive letter will appear in the Properties for that virtual machine in the VMM console.

Examples

Example 1: Connect a virtual DVD drive to a physical DVD drive

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> $DVDDrive = Get-SCVirtualDVDDrive -VM $VM | where { $_.Bus -eq 1 -and $_.LUN -eq 0 }
PS C:\> Set-SCVirtualDVDDrive -VirtualDVDDrive $DVDDrive -VMHostDrive "E:"

The first command gets the virtual machine object named VM01 and stores the object in the $VM variable.

The second command gets the virtual DVD drive object that is located on Secondary Channel 0 (specified by -Bus 1 and -LUN 0) on the IDE bus on VM01 and stores the object in the $DVDDrive variable.

The last command connects the virtual DVD drive object stored in $DVDDrive to a physical drive on the host (the D: drive). It also deletes any ISO file that the virtual DVD drive used earlier if no other virtual machine currently uses that ISO file.

Example 2: Connect a virtual DVD drive to a different location on the IDE bus

PS C:\> $VM = Get-SCVirtualMachine -Name "VM02"
PS C:\> $DVDDrive = Get-SCVirtualDVDDrive -VM $VM | where { $_.Bus -eq 1 -and $_.LUN -eq 0 }
PS C:\> Set-SCVirtualDVDDrive -VirtualDVDDrive $DVDDrive -Bus 1 -LUN 1

The command gets the virtual machine object named VM02 and stores the object in the $VM variable.

The second command gets the virtual DVD drive object that is located on Secondary Channel 0 (specified by -Bus 1 and -LUN 0) on the IDE bus on VM02 and then stores the virtual DVD drive object in $DVDDrive.

The last command connects the virtual DVD drive object stored in $DVDDrive to a different position on the IDE bus by setting the logical unit number (LUN) to 1.

Example 3: Disconnect a virtual DVD drive

PS C:\> $VM = Get-SCVirtualMachine -Name "VM03"
PS C:\> $DVDDrive = Get-SCVirtualDVDDrive -VM $VM | where { $_.Bus -eq 1 -and $_.LUN -eq 0 }
PS C:\> Set-SCVirtualDVDDrive -VirtualDVDDrive $DVDDrive -NoMedia

The first command gets the virtual machine object named VM03 and stores the object in the $VM variable.

The second command gets the virtual DVD drive object that is located on Secondary Channel 0 (specified by -Bus 1 and -LUN 0) on the IDE bus on VM03 and then stores the virtual DVD drive object in $DVDDrive.

The last command uses the NoMedia parameter to disconnect the virtual DVD drive object stored in $DVDDrive from any host drive or ISO to which it is connected. It also deletes any ISO file that the virtual DVD drive used earlier if no other virtual machine currently uses that ISO file.

Example 4: Connect a virtual DVD drive on an existing virtual machine to any available physical DVD drive

PS C:\> $VM = Get-SCVirtualMachine -Name "VM04"
PS C:\> Set-SCVirtualDVDDrive -AnyVMHostDrive -VirtualDVDDrive (Get-VirtualDVDDrive -VM $VM | where {$_.Bus -eq 1 -and $_.Lun -eq 0})

The first command gets the virtual machine object named VM04 and stores the object in the $VM variable.

The last command gets the virtual DVD drive object that is located on the first slot of the Secondary Channel (specified by -Bus 1 and -LUN 0) on the IDE bus on VM04. The command uses the Set-SCVirtualDVDDrive cmdlet with the AnyVMHostDrive parameter to connect the virtual DVD drive to any available physical DVD drive on the host.

Parameters

-AnyVMHostDrive

Indicates that a virtual DVD or floppy drive on a virtual machine will be connected to any corresponding physical drive on a host. This mapping occurs when you deploy a stored virtual machine on a host, or when you use a template or hardware profile to create and deploy a virtual machine on a host.

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

-Bus

Specifies the IDE bus to which to attach a virtual disk drive or virtual DVD drive, or the SCSI bus to which to attach a virtual disk drive.

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

-ISO

Specifies an ISO object.

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

-JobGroup

Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs.

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

-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

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

Indicates that a resource should be linked to instead of copied.

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

-LUN

Specifies the logical unit number (LUN) for a virtual disk drive object or for a virtual DVD drive object on an IDE bus, or for a virtual disk drive object on a SCSI bus.

  • Example format: -IDE -Bus 1 -LUN 0
  • Example format: -SCSI -Bus 0 -LUN 1
Type:Byte
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NoMedia

Disconnects a virtual DVD drive from the host drive or ISO to which it was connected, or disconnects a virtual floppy drive from the host drive or virtual floppy disk to which it was connected.

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

-OnBehalfOfUser

Specifies a user name. This cmdlet operates on behalf of the user that this parameter specifies.

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

-OnBehalfOfUserRole

Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.

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

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

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

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

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

-SourceBus

Specifies the source IDE bus for the drive.

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

-SourceLUN

Specifies the source logical unit number (LUN) for a virtual DVD drive object on an IDE bus.

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

-VirtualDVDDrive

Specifies a virtual DVD drive object.

Type:VirtualDVDDrive
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMHostDrive

Specifies a drive on a virtual machine host.

Example formats:

  • Hyper-V host hard drive: "C:"
  • Hyper-V host floppy drive: "A:"
  • VMware ESX host hard drive: "/dev/tools"
  • VMware ESX host floppy drive: "/dev/sda"
  • Citrix XenServer host hard drive: "Local storage\[99b6212f-b63d-c676-25f9-d6c460992de7\]"
  • Citrix XenServer host floppy drive: Not supported
Type:String
Aliases:HostDrive
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Outputs

VirtualDVDDrive

This cmdlet returns a VirtualDVDDrive object.

Notes

  • Requires a VMM virtual DVD drive object, which can be retrieved by using the Get-SCVirtualDVDDrive cmdlet.