Get-SCVirtualDiskDrive

Get-SCVirtualDiskDrive

Gets a virtual disk drive object on a virtual machine template or on a virtual machine managed by VMM.

構文

Parameter Set: All
Get-SCVirtualDiskDrive -All [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: ID
Get-SCVirtualDiskDrive [-ID] <Guid> [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: Template
Get-SCVirtualDiskDrive -VMTemplate <Template> [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: VM
Get-SCVirtualDiskDrive -VM <VM> [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

詳細説明

The Get-SCVirtualDiskDrive cmdlet gets one or more Virtual Machine Manager (VMM) virtual disk drive objects. These virtual disk drives can be configured on virtual machine templates stored in the library, or on virtual machines either deployed on a host or stored in the library.

パラメーター

-All

Retrieves a full list of all subordinate objects independent of the parent object. For example, the command Get-SCVirtualDiskDrive -All retrieves all virtual disk drive objects regardless of the virtual machine object or template object that each virtual disk drive object is associated with.

エイリアス

none

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

-ID<Guid>

Specifies the numerical identifier as a globally unique identifier (GUID) for a specific object.

エイリアス

none

必須?

true

位置は?

1

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

-OnBehalfOfUser<System.String>

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-OnBehalfOfUserRole<Microsoft.SystemCenter.VirtualMachineManager.UserRole>

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-VM<VM>

Specifies a virtual machine object.

エイリアス

none

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

-VMTemplate<Template>

Specifies a VMM template object used to create virtual machines.

エイリアス

Template

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

  • VirtualDiskDrive

  • Requires a VMM virtual machine template object or a virtual machine object, which can be retrieved by using the Get-SCVMTemplate or Get-SCVirtualMachine cmdlets, respectively.

Example Example 1: Get a list of all available virtual disk drives in your VMM environment.

This command gets a list of all virtual disk drives bound to all virtual machines registered to VMM on VMMServer01. The command displays information about each virtual disk drive.

PS C:\> Get-SCVirtualDiskDrive -VMMServer "VMMServer01.Contoso.com" -All

Example 2: Get virtual disk drives for a specific virtual machine

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

The second command gets all virtual disk drive objects on VM02, and then stores the objects in $VirtDiskDrive. If, as this example assumes, a virtual machine contains multiple virtual disk drives, each virtual disk drive has connected to it either a virtual hard disk or a pass-through disk.

The last command displays the properties of each virtual disk drive on VM02, including the name of any virtual hard disks and the path to the physical drive on the host for any pass-through disks.

PS C:\> $VM = Get-SCVirtualMachine -VMMServer "VMMServer01.Contoso.com" | where {$_.Name -eq "VM02"}
PS C:\> $VirtDiskDrive = Get-SCVirtualDiskDrive -VM $VM
PS C:\> $VirtDiskDrive

Example Example 3:. Count all virtual disk drives, except pass-through disks, on the second slot for both IDE channels.:

The first command gets the virtual disk drive objects, excluding pass-through disks, that are connected to the second slot of either IDE channel. Using the @ symbol and parentheses ensures that the command stores the results in an array in case the command returns a single object or $Null.

The second command displays the number of virtual disk drive objects that match the filter criteria.

PS C:\> $VirtDiskDrive = @(Get-SCVirtualDiskDrive -All | where {$_.BusType -eq 'IDE' -and $_.PassThroughDisk -eq $null -and $_.LUN -eq 1 -and ($_.Bus -eq 0 -or $_.Bus -eq 1)})
PS C:\> $VirtDiskDrive.Count

Example 4: Get virtual disk drives for all virtual machine templates

The first command gets all virtual machine template objects, and then stores the objects in $Templates. Using the @ symbol and parentheses ensures that the command stores the results in an array in case the command returns a single object or $Null.

The second command passes each virtual machine template object stored in $Templates to the ForEach-Object cmdlet which gets all disk drive objects for each template. Then the command selects only those virtual disk drive objects with an IDE bus type and passes those objects to the Format-List cmdlet. That cmdlet displays the Name, Bus Type, Bus, and LUN for each virtual disk drive object.

For more information about the standard Windows PowerShell ForEach-Object cmdlet type: Get-Help ForEach-Object.

PS C:\> $Templates = @(Get-SCVMTemplate)
PS C:\> $Templates | ForEach-Object {Get-SCVirtualDiskDrive -Template $_ | where {$_.BusType -eq "IDE"}} | Format-List Name,BusType,Bus,LUN

関連トピック

Compress-SCVirtualDiskDrive

Convert-SCVirtualDiskDrive

Expand-SCVirtualDiskDrive

New-SCVirtualDiskDrive

Remove-SCVirtualDiskDrive

Set-SCVirtualDiskDrive