Test-SCVirtualDiskDrive

Tests an existing virtual hard disk.

Syntax

Test-SCVirtualDiskDrive
    [-VirtualDiskDrive] <VirtualDiskDrive>
    [-JobGroup <Guid>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [<CommonParameters>]

Description

The Test-SCVirtualDiskDrive cmdlet tests an existing virtual hard disk that is attached to a virtual disk drive object.

To test a virtual hard disk, the virtual machine on which the virtual hard disk is configured must be in a stopped state.

Examples

Example 1: Test a dynamic VHD on a virtual machine

PS C:\> $VM = Get-SCVirtualMachine -Name "VM03"
PS C:\> $VirtDiskDrive = Get-SCVirtualDiskDrive -VM $VM
PS C:\> If ($VM.Status -Eq "Running") {Stop-SCVirtualMachine -VM $VM -Shutdown}
PS C:\> Test-SCVirtualDiskDrive -VirtualDiskDrive $VirtDiskDrive

The first command gets the virtual machine object named VM03 by using the Get-SCVirtualMachine cmdlet. This command stores that object in the $VM variable.

The second command gets the virtual disk drive object that is attached to virtual machine VM03, and then stores that object in the $VirtDiskDrive variable. This example assumes that the virtual machine has only one virtual disk drive object and that the virtual hard disk attached to the virtual disk drive is a dynamic virtual hard disk.

The third command determines whether VM03 is running. If VM03 is running, the command shuts down the virtual machine.

The last command tests the virtual hard disk stored in $VirtDiskDrive.

Parameters

-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
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JobVariable

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

Type:String
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

-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
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False