Set-SCVirtualDiskDrive

Modifies settings of a virtual disk drive.

Syntax

Set-SCVirtualDiskDrive [-Bus <Byte>] [-CreateDiffDisk <Boolean>] [-DisableStorageQoS] [-IDE] [-JobGroup <Guid>]
 [-JobVariable <String>] [-LUN <Byte>] [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>]
 [-PROTipID <Guid>] [-RunAsynchronously] [-SCSI] [-SharedStorage <Boolean>]
 [-StorageClassification <StorageClassification>] -VirtualDiskDrive <VirtualDiskDrive>
 [-VolumeType <VolumeType>] [<CommonParameters>]
Set-SCVirtualDiskDrive [-Bus <Byte>] [-CreateDiffDisk <Boolean>] [-IDE] -IOPSMaximum <UInt64>
 [-JobGroup <Guid>] [-JobVariable <String>] [-LUN <Byte>] [-OnBehalfOfUser <String>]
 [-OnBehalfOfUserRole <UserRole>] [-PROTipID <Guid>] [-RunAsynchronously] [-SCSI] [-SharedStorage <Boolean>]
 [-StorageClassification <StorageClassification>] -VirtualDiskDrive <VirtualDiskDrive>
 [-VolumeType <VolumeType>] [<CommonParameters>]
Set-SCVirtualDiskDrive [-Bus <Byte>] [-CreateDiffDisk <Boolean>] [-IDE] [-JobGroup <Guid>]
 [-JobVariable <String>] [-LUN <Byte>] [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>]
 [-PROTipID <Guid>] [-RunAsynchronously] [-SCSI] [-SharedStorage <Boolean>]
 [-StorageClassification <StorageClassification>] -StorageQoSPolicy <StorageQoSPolicy>
 -VirtualDiskDrive <VirtualDiskDrive> [-VolumeType <VolumeType>] [<CommonParameters>]

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

Examples

Example 1: Change the IDE bus and LUN settings for a virtual disk drive

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 by using the Get-SCVirtualMachine cmdlet. The command stores that object in the $VM variable.

The second command gets the virtual disk drive object on VM01, and then stores the object in $VirtDiskDrive. Using the @ symbol and parentheses make sure that the command stores the results in an array even if 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 virtual machine has only one virtual disk drive and is located on the second slot of the first IDE channel.

Example 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 then stores that object in the $VM variable.

The second command gets all virtual disk drive objects configured for the virtual machine stored in $VM, and stores those 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. The command connects the second virtual disk drive, specified by $VirtDiskDrive[1], to Primary Channel (1) and slot 2, specified by -Bus 0 and LUN 1.

Parameters

-Bus

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

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

Indicates whether the cmdlet creates a differencing disk.

Type:Boolean
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisableStorageQoS

Indicates this cmdlet disables storage Quality of Service (QoS) standards.

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

Indicates that IDE is the bus type to which to attach a virtual disk drive object configured on a virtual machine or on a template.

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

Specifies the maximum IOPS.

Type:UInt64
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-JobGroup

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

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

Specifies a variable in which job progress is tracked and stored.

Type:String
Required:False
Position:Named
Default value:None
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 disk drive object on a SCSI bus.

Type:Byte
Required:False
Position:Named
Default value:None
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
Required:False
Position:Named
Default value:None
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
Required:False
Position:Named
Default value:None
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
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.

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

Specifies SCSI as the bus type to which to attach a virtual disk drive object configured on a virtual machine or on a template.

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

Indicates whether the virtual disk drive uses shared storage.

Type:Boolean
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StorageClassification

Specifies a storage classification object.

Type:StorageClassification
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StorageQoSPolicy

Specifies a storage QoS policy.

Type:StorageQoSPolicy
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VirtualDiskDrive

Specifies a virtual disk drive object. You can attach either a virtual hard disk or a pass-through disk to a virtual disk drive object.

Type:VirtualDiskDrive
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-VolumeType

Specifies the volume type for a virtual hard disk. The acceptable values for this parameter are:

- Boot

  • System
  • BootAndSystem
  • None

Type:VolumeType
Parameter Sets:None, Boot, System, BootAndSystem
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Outputs

VirtualDiskDrive

This cmdlet returns a **VirtualDiskDrive** object.

Notes

* This cmdlet requires a VMM virtual disk drive object, which can be retrieved by using the **Get-SCVirtualDiskDrive** cmdlet.