Get-Disk

Get-Disk

Gets one or more disks visible to the operating system.

Sintaxe

Parameter Set: ByNumber
Get-Disk [[-Number] <UInt32[]> ] [-AsJob] [-CimSession <CimSession[]> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByiSCSIConnection
Get-Disk [-AsJob] [-CimSession <CimSession[]> ] [-iSCSIConnection <CimInstance> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByiSCSISession
Get-Disk [-AsJob] [-CimSession <CimSession[]> ] [-iSCSISession <CimInstance> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByName
Get-Disk [-AsJob] [-CimSession <CimSession[]> ] [-FriendlyName <String[]> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByPartition
Get-Disk [-AsJob] [-CimSession <CimSession[]> ] [-Partition <CimInstance> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByPath
Get-Disk [-AsJob] [-CimSession <CimSession[]> ] [-Path <String[]> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByUniqueId
Get-Disk [-AsJob] [-CimSession <CimSession[]> ] [-ThrottleLimit <Int32> ] [-UniqueId <String[]> ] [ <CommonParameters>]

Parameter Set: ByVirtualDisk
Get-Disk [-AsJob] [-CimSession <CimSession[]> ] [-ThrottleLimit <Int32> ] [-VirtualDisk <CimInstance> ] [ <CommonParameters>]

Descrição detalhada

The Get-Disk cmdlet gets one or more Disk objects visible to the operating system, or optionally a filtered list.

Parâmetros

-AsJob

Aliases

nenhuma

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

false

Aceitar caracteres curinga?

false

-CimSession<CimSession[]>

Executa o cmdlet em uma sessão remota ou em um computador remoto. Insira um nome do computador ou um objeto de sessão, como a saída de um cmdlet New-CimSession ou Get-CimSession. O padrão é a sessão atual do computador local.

Aliases

Session

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

false

Aceitar caracteres curinga?

false

-FriendlyName<String[]>

Gets the disk with the specified friendly name. Enter a friendly name, or use wildcard characters to enter a name pattern.

Aliases

nenhuma

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

false

Aceitar caracteres curinga?

false

-Number<UInt32[]>

Specifies the disk number for which to get the associated Disk object.

Aliases

DeviceId

Necessário?

false

Posição?

1

Valor padrão

nenhuma

Aceitar entrada do pipeline?

True (ByPropertyName)

Aceitar caracteres curinga?

false

-Partition<CimInstance>

Accepts a Partition object as input. The Partition CIM object is exposed by the Get-Partition cmdlet.

Aliases

nenhuma

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

True (ByValue)

Aceitar caracteres curinga?

false

-Path<String[]>

Contains valid path information.

Aliases

nenhuma

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

True (ByPropertyName)

Aceitar caracteres curinga?

false

-ThrottleLimit<Int32>

Especifica o número máximo de operações simultâneas que podem ser estabelecidas para executar o cmdlet. Se esse parâmetro for omitido ou um valor de 0 for inserido, o Windows PowerShell® calculará o limite ideal de restrição para o cmdlet com base no número de cmdlets do CIM que estão em execução no computador. O limite de restrição se aplica somente ao cmdlet atual, e não à sessão ou ao computador.

Aliases

nenhuma

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

false

Aceitar caracteres curinga?

false

-UniqueId<String[]>

Gets only the disks with the specified IDs. Type one or more IDs (separated by commas).

Aliases

Id

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

false

Aceitar caracteres curinga?

false

-VirtualDisk<CimInstance>

Accepts a VirtualDisk object as input. The Virtual Disk CIM object is exposed by the Get-VirtualDisk cmdlet.

Aliases

nenhuma

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

True (ByValue)

Aceitar caracteres curinga?

false

-iSCSIConnection<CimInstance>

Accepts an iSCSIConnection object as input. The iSCSI Connection CIM object is exposed by the Get-IscsiConnection cmdlet.

Aliases

nenhuma

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

True (ByValue)

Aceitar caracteres curinga?

false

-iSCSISession<CimInstance>

Accepts an iSCSISession object as input. The iSCSI Session CIM object is exposed by the Get-IscsiSession cmdlet.

Aliases

nenhuma

Necessário?

false

Posição?

named

Valor padrão

nenhuma

Aceitar entrada do pipeline?

True (ByValue)

Aceitar caracteres curinga?

false

<CommonParameters>

Esse cmdlet dá suporte a parâmetros comuns: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer e -OutVariable. Para obter mais informações, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

O tipo de entrada é o tipo dos objetos que você pode canalizar para o cmdlet.

Saídas

O tipo de saída é o tipo de objeto emitido pelo cmdlet.

Observações

  • O objeto Microsoft.Management.Infrastructure.CimInstance é uma classe wrapper que exibe objetos da WMI (Instrumentação de Gerenciamento do Windows). O caminho após o sinal de cerquilha (#) indica o namespace e o nome de classe do objeto subjacente da WMI.

  • Some objects such as disks might include trailing spaces in their friendly names. If you suspect that an object name could have trailing spaces, you can use a wildcard at the end of the name, for example Disk*, or use the Match parameter to instruct Windows PowerShell to include all strings that include the specified characters, instead of only strings that include only the specified characters.

Exemplos

Example 1: Get all disks

This example gets all disks visible to the operating system.

PS C:\> Get-Disk

Example 2: Get a disk by disk number

This example gets disk 6.

PS C:\> Get-Disk -Number 6

Example 3: Get all USB disks

This example gets all disks attached via the USB bus by piping the output of Get-Disk to the Where-Object cmdlet, and filtering by the USB value of the Bustype property.

PS C:\> Get-Disk | Where-Object –FilterScript {$_.Bustype -Eq "USB"}

 

Example 4: Get the iSCSI sessions for all iSCSI disks

This example gets all disks attached via the iSCSI bus by piping the output of Get-Disk to the Where-Object cmdlet, and filtering by the iSCSI value of the Bustype property. It then passes the Disk objects in the pipeline to the Get-IscisSession cmdlet, which gets the associated iSCSI sessions, and then pipes the output to the Format-Table cmdlet for simplified display.

PS C:\> Get-Disk | Where-Object –FilterScript {$_.BusType -Eq "iSCSI"} |
Get-IscsiSession | Format-Table

Tópicos relacionados

Clear-Disk

Get-Partition

Initialize-Disk

Set-Disk

Update-Disk

Where-Object