Set-SCVirtualDiskDrive

Modifies settings of a virtual disk drive object on a virtual machine or on a virtual machine template in a VMM environment.

Description

The Set-SCVirtualDiskDrive cmdlet modifies settings of a virtual disk drive object on a virtual machine or on a virtual machine template in a System Center Virtual Machine Manager (VMM) environment. You can use this cmdlet to change the Bus type (IDE or SCSI), or to change the Bus and LUN settings to connect a virtual disk drive to a different location on the bus.

For more information about Set-SCVirtualDiskDrive, type: "Get-Help Set-SCVirtualDiskDrive -online".

Parameters

VirtualDiskDrive

Required? true
Accept Pipeline Input? true (ByValue)
Position? named
Specifies a virtual disk drive object. You can attach either a virtual hard disk (for a virtual machine on any host) or a pass-through disk (for a virtual machine on a Hyper-V host or an ESX host) to a virtual disk drive object.

Bus

Required? false
Accept Pipeline Input? false
Position? named
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.

IDE

Required? false
Accept Pipeline Input? false
Position? named
Specifies IDE as the bus type to which to attach a virtual disk drive object or a virtual DVD drive object configured on a virtual machine or on a template.

Example format: -IDE –Bus 0 –LUN 1 

JobGroup

Required? false
Accept Pipeline Input? false
Position? named
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. 

JobVariable

Required? false
Accept Pipeline Input? false
Position? named
Specifies that job progress is tracked and stored in the variable named by this parameter. 

LUN

Required? false
Accept Pipeline Input? false
Position? named
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

PROTipID

Required? false
Accept Pipeline Input? false
Position? named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

RunAsynchronously

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the job runs asynchronously so that control returns to the command shell immediately. 

SCSI

Required? false
Accept Pipeline Input? false
Position? named
Specifies SCSI as the bus type to which to attach a virtual disk drive object configured on a virtual machine or on a template. 

Example format: -SCSI -Bus 0 -LUN 0

StorageClassification

Required? false
Accept Pipeline Input? false
Position? named
Specifies a storage classification object.

VolumeType

Required? false
Accept Pipeline Input? false
Position? named
Specifies the volume type for a virtual hard disk. Valid values: Boot, System, BootAndSystem, None.
Requires a VMM virtual disk drive object, which can be retrieved by using the Get-SCVirtualDiskDrive cmdlet.

Examples

1: Change the IDE bus and LUN settings for a virtual disk drive on a virtual machine.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> $VirtDiskDrive = @(Get-SCVirtualDiskDrive -VM $VM)
PS C:\> if($VirtDiskDrive.Count -eq 1 -and $VirtDiskDrive[0].Bus -eq 0 -and $VirtDiskDrive[0].Lun -eq 1){Set-SCVirtualDiskDrive -VirtualDiskDrive $VirtDiskDrive[0] -Bus 0 -LUN 0}
The first command gets the virtual machine object VM01 and stores the object in the $VM variable.

The second command gets the virtual disk drive object on VM01 and stores the object in $VirtDiskDrive. Using the '@' symbol and parentheses ensures that the command stores the results in an array in case the command returns a single object or a null value.

The last command sets the Bus value to 0 and sets the LUN value to 0 for the virtual disk drive on VM01 if the VM has only one virtual disk drive and is located on the second slot of the first IDE channel.
2: Change the bus type for a virtual disk drive from SCSI to IDE.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM02"
PS C:\> $VirtDiskDrive = Get-SCVirtualDiskDrive -VM $VM
PS C:\> Set-SCVirtualDiskDrive -VirtualDiskDrive $VirtDiskDrive[1] -IDE -Bus 0 -LUN 1
The first command gets the virtual machine object named VM02 and stores the object in the $VM variable.

The second command gets all virtual disk drive objects configured for the virtual machine stored in $VM and stores the virtual disk drive objects in the $VirtDiskDrive object array. This example assumes that the virtual disk drive is on a SCSI bus.

The last command sets the Bus type to IDE and connects the second virtual disk drive (specified by $VirtDiskDrive[1]) to Primary Channel (1) and slot 2 (specified by -Bus 0 and LUN 1).

See Also