Get-Disk

Get one or more disks visible to the operating system.

Syntax
 Get-Disk { [[-Number] UInt32[]] | [-UniqueId String[]] | [-Path String[]] | [-Partition CimInstance]
 | [-VirtualDisk CimInstance] | [-iSCSISession CimInstance] | [-iSCSIConnection CimInstance]
 | [-StorageSubSystem CimInstance] | [-StorageNode CimInstance] | [-StorageJob CimInstance] }
 [-CimSession CimSession[]] [-ThrottleLimit Int32] [-AsJob] [CommonParameters ]
 Get-Disk [-FriendlyName String[]] [-SerialNumber String[]]
 [-CimSession CimSession[]] [-ThrottleLimit Int32] [-AsJob] [CommonParameters ]
Key
 -AsJob
 Run the cmdlet as a background job.
 Use this parameter to run commands that take a long time to complete.
 -CimSession
 Run the cmdlet in a remote session or on a remote computer.
 Enter a computer name or a session object, such as the output of New-CimSession or Get-CimSession.
 The default is the current session on the local computer.
 -FriendlyName
 Get the disk with the specified friendly name.
 Enter a friendly name, or use wildcard characters to enter a name pattern.
 -iSCSIConnection
 Accepts an iSCSIConnection object as input.
 The iSCSI Connection CIM object is exposed by the Get-IscsiConnection cmdlet.
 -iSCSISession
 Accepts an iSCSISession object as input.
 The iSCSI Session CIM object is exposed by the Get-IscsiSession cmdlet.
 -Number
 Specifies the disk number for which to get the associated Disk object.
 -Partition
 Accepts a Partition object as input.
 The Partition CIM object is exposed by the Get-Partition cmdlet.
 -Path
 Contains valid path information.
 -SerialNumber
 Specifies an array of serial numbers associated with disks that this cmdlet gets.
 -StorageJob
 Specifies a storage job object that is associated with disks that this cmdlet gets.
 To obtain a storage job, use the Get-StorageJob cmdlet.
 -StorageNode
 Specifies a storage Node object.
 -StorageSubSystem
 Specifies the storage subsystem from which this cmdlet gets disks.
 To obtain a StorageSubsystem object, use the Get-StorageSubSystem cmdlet.
 -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 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.
 -UniqueId
 Get only disks with the specified IDs. Type one or more IDs (separated by commas).
 -VirtualDisk
 Accepts a VirtualDisk object as input.
 The Virtual Disk CIM object is exposed by the Get-VirtualDisk cmdlet.

This cmdlet returns physical disk objects like basic disks and partitioned drive partitions. Dynamic disks can span multiple pieces of physical media, so they will not be returned by Get-Disk.

Examples

Get all disks:

PS C:\> Get-Disk

Get a disk by disk number:

PS C:\> Get-Disk -Number 6

Get all USB disks:

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

Get the iSCSI sessions for all iSCSI disks:

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

"Blinking is some way of tabulating - a kind of carriage return, click, or save to disk - that helps the process of 'Okay, now change the subject.' Every time you move your eyes, there's an interruption in the visual field - you go momentarily blind when your eyeballs are moving" ~ Walter Murch

Related PowerShell Cmdlets

Clear-Disk - Remove all partition information and un-initialize a disk, erasing all data.
Set-Disk - Set attributes and update a physical disk.
Initialize-Disk - Initialize a RAW disk for first use, this enables formatting.
Update-Disk - Update cached information about the specified Disk object only.
Get-PSDrive - Get drive information.

(追記) (追記ここまで)
Copyright © 1999-2026 SS64.com
Some rights reserved

AltStyle によって変換されたページ (->オリジナル) /