Share via


New-SCVirtualDVDDrive

New-SCVirtualDVDDrive

Creates a virtual DVD drive on a virtual machine, a virtual machine template, or a hardware profile used in VMM.

Syntax

Parameter Set: HardwareProfile
New-SCVirtualDVDDrive -Bus <Byte> -HardwareProfile <HardwareProfile> -LUN <Byte> [-AnyVMHostDrive] [-ISO <ISO> ] [-JobVariable <String> ] [-Link] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMHostDrive <String> ] [ <CommonParameters>]

Parameter Set: JobGroup
New-SCVirtualDVDDrive -Bus <Byte> -JobGroup <Guid]> -LUN <Byte> [-AnyVMHostDrive] [-ISO <ISO> ] [-JobVariable <String> ] [-Link] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMHostDrive <String> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: Template
New-SCVirtualDVDDrive -Bus <Byte> -LUN <Byte> -VMTemplate <Template> [-AnyVMHostDrive] [-ISO <ISO> ] [-JobVariable <String> ] [-Link] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMHostDrive <String> ] [ <CommonParameters>]

Parameter Set: VM
New-SCVirtualDVDDrive -Bus <Byte> -LUN <Byte> -VM <VM> [-AnyVMHostDrive] [-ISO <ISO> ] [-JobVariable <String> ] [-Link] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMHostDrive <String> ] [ <CommonParameters>]

Detailed Description

The New-SCVirtualDVDDrive cmdlet creates a virtual DVD drive object on a virtual machine, a virtual machine template, or a hardware profile used in a Virtual Machine Manager (VMM) environment. By default, the virtual DVD drive created by New-SCVirtualDVDDrive is not connected to any media. You can use the Set-SCVirtualDVDDrive cmdlet to connect a virtual DVD drive to a physical DVD drive on a virtual machine host or to an ISO image.

Note: You can connect a virtual DVD drive to an IDE device on a virtual machine but you cannot connect a virtual DVD drive to a SCSI adapter on a virtual machine.

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.

Aliases

AnyHostDrive

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Bus<Byte>

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.

Example format: -IDE -Bus 1 -LUN 0

Example format: -SCSI -Bus 0 -LUN 1

NOTE: See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-HardwareProfile<HardwareProfile>

Specifies a hardware profile object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-ISO<ISO>

Specifies an ISO object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobGroup<Guid]>

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.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LUN<Byte>

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

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUser<System.String>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUserRole<Microsoft.SystemCenter.VirtualMachineManager.UserRole>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid]>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VM>

Specifies a virtual machine object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMHostDrive<String>

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

Aliases

HostDrive

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMTemplate<Template>

Specifies a VMM template object used to create virtual machines.

Aliases

Template

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

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.

Outputs

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

  • VirtualDVDDrive

Notes

  • This cmdlet requires a VMM virtual machine object, virtual machine template object, or hardware profile object. You can retrieve these objects by using the Get-SCVirtualMachine, Get-SCVMTemplate, or Get-SCHardwareProfile cmdlets, respectively.

Examples

Example 1: Create a virtual DVD drive on a virtual machine

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

The second command creates a virtual DVD drive on VM01 and attaches the virtual DVD drive to Secondary channel (1) by specifying IDE Bus 1 and LUN 1.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> New-SCVirtualDVDDrive -VM $VM -Bus 1 -LUN 1

Example Example 2: Create a virtual DVD drive on a virtual machine template.

The first command gets the virtual machine template object named VMTemplate01, and then stores the object in the $Template variable.

The second command creates a virtual DVD drive on VMTemplate01 that attaches a virtual DVD drive to Secondary Channel (1) on the IDE bus when the template is used to create a virtual machine.

PS C:\> $VMTemplate = Get-SCVMTemplate | where { $_.Name -eq "VMTemplate01" }
PS C:\> New-SCVirtualDVDDrive -VMTemplate $VMTemplate -Bus 1 -LUN 1

Example 3: Create a virtual DVD drive on a hardware profile

The first command gets the hardware profile object named NewHardwareProfile01, and then stores the object in the $HWProfile variable.

The second command creates a virtual DVD drive on HardwareProfile1 that attaches a virtual DVD drive to Secondary Channel (1) on the IDE bus when the hardware profile is used to create a virtual machine.

PS C:\> $HWProfile = Get-SCHardwareProfile | where { $_.Name -eq "NewHWProfile01" }
PS C:\> New-SCVirtualDVDDrive -HardwareProfile $HWProfile -Bus 1 -LUN 1

Example Example 4.: Create a virtual machine with a virtual DVD drive that connects to any available physical DVD drive on the host.:

The first command creates a new GUID string and stores it to variable $JobGroupID. This GUID is a job group ID that functions as an identifier that groups subsequent commands that include this identifier into a single job group.

The second command creates a new virtual DVD drive object and specifies that this new virtual DVD drive can use any available physical DVD drive. The command will attach the new virtual DVD drive to the first slot of the second IDE channel. IDE is the only bus type that a virtual DVD drive can be attached to. Using the job group ID specifies that that this command will not run until just before the final command that includes the JobGroup parameter runs.

The third command gets the host object named VMHost04, and then stores the object in the $VMHost variable.

The last command creates a virtual machine, names it VM04, provides a description, assigns an owner, and specifies the location on the host to store the virtual machine. The command uses the job group ID to run the New-SCVirtualDVDDrive command just before the New-SCVirtualMachine command runs. The resulting virtual DVD drive object is associated with the new virtual machine.

PS C:\> $JobGroupId = [Guid]::NewGuid().ToString()
PS C:\> New-SCVirtualDVDDrive -VMMServer "VMMServer01.Contoso.com" -JobGroup $JobGroupId -Bus 1 -LUN 0 -AnyVMHostDrive
PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost04"
PS C:\> New-SCVirtualMachine -Name "VM04" -Description "A new VM with a DVD drive" -VMMServer "VMMServer01.Contoso.com" -Owner "Contoso\Katarina" -VMHost $VMHost -Path "D:\VirtualMachinePath" -StartVM -JobGroup $JobGroupId

Example Example 5:. Add a new virtual DVD drive to an existing virtual machine and attach an ISO file from the library to the drive.:

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

The second command gets the ISO object named WindowsServer2008R2.iso, and then stores the object in the $ISO variable.

The last command creates a new virtual DVD drive on VM05, attaches it to the specified location on the IDE bus, and links it with the ISO image stored in $ISO.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM05"
PS C:\> $ISO = Get-SCISO | where {$_.Name -eq "WindowsServer2008R2.iso"}
PS C:\> New-SCVirtualDVDDrive -VM $VM -ISO $ISO -Bus 1 -LUN 1

Get-SCHardwareProfile

Get-SCVirtualMachine

Get-SCVMMServer

Get-SCVMTemplate

Remove-SCVirtualDVDDrive

Set-SCVirtualDVDDrive

Get-SCISO

Get-SCVMHost

New-SCVirtualMachine