Skip to content

Latest commit

 

History

History
304 lines (232 loc) · 8.27 KB

File metadata and controls

304 lines (232 loc) · 8.27 KB
external help file Module Name online version schema
Storage2_Cmdlets.xml
Storage
2.0.0

Get-Disk

SYNOPSIS

Gets one or more disks visible to the operating system.

SYNTAX

UNNAMED_PARAMETER_SET_1

Get-Disk [[-Number] <UInt32[]>] [-AsJob] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>]

UNNAMED_PARAMETER_SET_2

Get-Disk [-AsJob] [-CimSession <CimSession[]>] [-iSCSIConnection <CimInstance>] [-ThrottleLimit <Int32>]

UNNAMED_PARAMETER_SET_3

Get-Disk [-AsJob] [-CimSession <CimSession[]>] [-iSCSISession <CimInstance>] [-ThrottleLimit <Int32>]

UNNAMED_PARAMETER_SET_4

Get-Disk [-AsJob] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-VirtualDisk <CimInstance>]

UNNAMED_PARAMETER_SET_5

Get-Disk [-AsJob] [-CimSession <CimSession[]>] [-Partition <CimInstance>] [-ThrottleLimit <Int32>]

UNNAMED_PARAMETER_SET_6

Get-Disk [-AsJob] [-CimSession <CimSession[]>] [-Path <String[]>] [-ThrottleLimit <Int32>]

UNNAMED_PARAMETER_SET_7

Get-Disk [-AsJob] [-CimSession <CimSession[]>] [-FriendlyName <String[]>] [-ThrottleLimit <Int32>]

UNNAMED_PARAMETER_SET_8

Get-Disk [-AsJob] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-UniqueId <String[]>]

DESCRIPTION

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

EXAMPLES

Example 1: Get all disks

PS C:\>Get-Disk

This example gets all disks visible to the operating system.

Example 2: Get a disk by disk number

PS C:\>Get-Disk -Number 6

This example gets disk 6.

Example 3: Get all USB disks

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

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.

Example 4: Get the iSCSI sessions for all iSCSI disks

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

Get-IscsiSession | Format-Table

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-IscsiSession cmdlet, which gets the associated iSCSI sessions, and then pipes the output to the Format-Table cmdlet for simplified display.

PARAMETERS

-AsJob

ps_cimcommon_asjob

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSessionhttp://go.microsoft.com/fwlink/p/?LinkId=227967 or Get-CimSessionhttp://go.microsoft.com/fwlink/p/?LinkId=227966 cmdlet. The default is the current session on the local computer.

Type: CimSession[]
Parameter Sets: (All)
Aliases: Session

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FriendlyName

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

Type: String[]
Parameter Sets: UNNAMED_PARAMETER_SET_7
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Number

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

Type: UInt32[]
Parameter Sets: UNNAMED_PARAMETER_SET_1
Aliases: DeviceId

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Partition

Accepts a Partition object as input. The Partition CIM object is exposed by the Get-Partitionhttp://technet.microsoft.com/library/85bb3c53-536e-408f-b159-28e91afeb1a1 cmdlet.

Type: CimInstance
Parameter Sets: UNNAMED_PARAMETER_SET_5
Aliases: 

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

-Path

Contains valid path information.

Type: String[]
Parameter Sets: UNNAMED_PARAMETER_SET_6
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ThrottleLimit

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Type: Int32
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-UniqueId

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

Type: String[]
Parameter Sets: UNNAMED_PARAMETER_SET_8
Aliases: Id

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-VirtualDisk

Accepts a VirtualDisk object as input. The Virtual Disk CIM object is exposed by the Get-VirtualDiskhttp://technet.microsoft.com/library/0eeba53f-6468-485f-a680-49260b4c83f0 cmdlet.

Type: CimInstance
Parameter Sets: UNNAMED_PARAMETER_SET_4
Aliases: 

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

-iSCSIConnection

Accepts an iSCSIConnection object as input. The iSCSI Connection CIM object is exposed by the Get-IscsiConnectionhttp://technet.microsoft.com/library/e566d297-76ad-48d0-b5af-11674f23b080 cmdlet.

Type: CimInstance
Parameter Sets: UNNAMED_PARAMETER_SET_2
Aliases: 

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

-iSCSISession

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

Type: CimInstance
Parameter Sets: UNNAMED_PARAMETER_SET_3
Aliases: 

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

INPUTS

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_IscsiConnection

You can pipe an iSCSIConnection object to the iSCSIConnection parameter.

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_IscsiSession

You can pipe an iSCSISession object to the iSCSISession parameter.

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Partition

You can pipe a Partition object to the Partition parameter.

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk

You can pipe a VirtualDisk object to the VirtualDisk parameter.

OUTPUTS

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk

This cmdlet outputs one or more objects representing disks.

NOTES

  • The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.
  • 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.

RELATED LINKS

Where-Object

Clear-Disk

Get-Partition

Initialize-Disk

Set-Disk

Update-Disk