< Back

Get-Disk

Wed Jan 30, 2019 6:01 pm

NAME Get-Disk



SYNOPSIS

Gets one or more disks visible to the operating system.





SYNTAX

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



Get-Disk [-CimSession <CimSession[]>] [-FriendlyName <String[]>] [-SerialNumber <System.String[]>] [-ThrottleLimit <Int32>] [<CommonParameters>]



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



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



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



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



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



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



Get-Disk [-StorageJob <CimInstance>] [<CommonParameters>]



Get-Disk [-StorageNode <Microsoft.Management.Infrastructure.CimInstance>] [<CommonParameters>]



Get-Disk [-StorageSubSystem <Microsoft.Management.Infrastructure.CimInstance>] [<CommonParameters>]





DESCRIPTION

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





PARAMETERS

-CimSession [<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-CimSession or

Get-CimSession cmdlet. The default is the current session on the local computer.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-FriendlyName [<String[]>]

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



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-Number [<UInt32[]>]

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



Required? false

Position? 1

Default value none

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Partition [<CimInstance>]

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



Required? false

Position? named

Default value none

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Path [<String[]>]

Contains valid path information.



Required? false

Position? named

Default value none

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-SerialNumber [<System.String[]>]

Specifies an array of serial numbers associated with disks that this cmdlet gets.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-StorageJob [<CimInstance>]

Specifies a storage job object that is associated with disks that this cmdlet gets. To obtain a storage job, use the Get-StorageJob cmdlet.



Required? false

Position? named

Default value none

Accept pipeline input? true(ByValue)

Accept wildcard characters? false



-StorageNode [<Microsoft.Management.Infrastructure.CimInstance>]





Required? false

Position? named

Default value none

Accept pipeline input? true(ByValue)

Accept wildcard characters? false



-StorageSubSystem [<Microsoft.Management.Infrastructure.CimInstance>]

Specifies the storage subsystem from which this cmdlet gets disks. To obtain a StorageSubsystem object, use the Get-StorageSubSystem cmdlet.



Required? false

Position? named

Default value none

Accept pipeline input? true(ByValue)

Accept wildcard characters? false



-ThrottleLimit [<Int32>]

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.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-UniqueId [<String[]>]

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



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-VirtualDisk [<CimInstance>]

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



Required? false

Position? named

Default value none

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-iSCSIConnection [<CimInstance>]

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



Required? false

Position? named

Default value none

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-iSCSISession [<CimInstance>]

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



Required? false

Position? named

Default value none

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

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

http://msdn.microsoft.com/library/windo ... 68122.aspx





You can pipe an iSCSIConnection object to the iSCSIConnection parameter.



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

http://msdn.microsoft.com/library/windo ... 68125.aspx





You can pipe an iSCSISession object to the iSCSISession parameter.



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

http://msdn.microsoft.com/library/windo ... 30524.aspx





You can pipe a Partition object to the Partition parameter.



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

http://msdn.microsoft.com/library/windo ... 30584.aspx





You can pipe a VirtualDisk object to the VirtualDisk parameter.





OUTPUTS

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

http://msdn.microsoft.com/library/windo ... 30532.aspx





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.



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-IscisSession cmdlet, which gets the associated iSCSI sessions, and then

pipes the output to the Format-Table cmdlet for simplified display.







RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkId=812860

Where-Object

Clear-Disk

Get-Partition

Get-StorageJob

Get-StorageSubsystem

Initialize-Disk

Set-Disk

Update-Disk