PowerShell Logo Small

Get-Disk



This is the built-in help made by Microsoft for the command 'Get-Disk', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets one or more disks visible to the operating system.

SYNTAX


Get-Disk [[-Number] <UInt32[]>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [<CommonParameters>]
Get-Disk [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-iSCSIConnection <CimInstance>] [-ThrottleLimit <Int32>]
[<CommonParameters>]
Get-Disk [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-iSCSISession <CimInstance>] [-ThrottleLimit <Int32>] [<CommonParameters>]
Get-Disk [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-VirtualDisk <CimInstance>] [<CommonParameters>]
Get-Disk [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-Partition <CimInstance>] [-ThrottleLimit <Int32>] [<CommonParameters>]
Get-Disk [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-Path <String[]>] [-ThrottleLimit <Int32>] [<CommonParameters>]
Get-Disk [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-FriendlyName <String[]>] [-ThrottleLimit <Int32>] [<CommonParameters>]
Get-Disk [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-UniqueId <String[]>] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


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



<

RELATED LINKS

Where-Object
Clear-Disk
Get-Partition
Initialize-Disk
Set-Disk
Update-Disk

REMARKS

<

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"}


PS C:\>



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.