Get-Partition
Returns a list of all partition objects visible on all disks, or optionally a filtered list using specified parameters.
Syntax
ByUniqueId (Default)
Get-Partition
[-UniqueId <String[]>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[<CommonParameters>]
ById
Get-Partition
-DiskId <String[]>
[-Offset <UInt64[]>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[<CommonParameters>]
ByNumber
Get-Partition
[[-DiskNumber] <UInt32[]>]
[[-PartitionNumber] <UInt32[]>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[<CommonParameters>]
ByDriveLetter
Get-Partition
[-DriveLetter <Char[]>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[<CommonParameters>]
ByDisk
Get-Partition
[-Disk <CimInstance>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[<CommonParameters>]
ByVolume
Get-Partition
[-Volume <CimInstance>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[<CommonParameters>]
ByStorageSubSystem
Get-Partition
[-StorageSubSystem <CimInstance>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[<CommonParameters>]
Description
The Get-Partition cmdlet returns one or more Partition objects depending on the specified criteria. This cmdlet will return a Volume object or a set of Volume objects given parameters to be used to uniquely identify a volume, or parameters to identify a set of volumes that meet the given set of criteria.
Examples
Example 1
PS C:\>Get-Partition
This example returns all partitions, on all disks.
Example 2
PS C:\>Get-Partition -DiskNumber 5
Disk Number: 5
PartitionNumber DriveLetter Offset Size Type
--------------- ----------- ------ ---- ----
1 H 1048576 298.09 GB IFS
This example returns all partitions on disk 5.
Example 3
PS C:\>Get-Partition -DriveLetter C
Disk Number: 0
PartitionNumber DriveLetter Offset Size Type
--------------- ----------- ------ ---- ----
2 C 368050176 465.42 GB IFS
This example returns partitions associated with the volume for drive letter C.
Example 4
PS C:\>Get-Partition | Where-Object -FilterScript {$_.Type -Eq "Basic"}
This example returns only the basic partitions on all disks.
Parameters
-AsJob
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.
Parameter properties
Type: | CimSession[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | Session |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Disk
Accepts a Disk object as input. The Disk CIM object is exposed by the Get-Disk cmdlet.
Parameter properties
Type: | CimInstance |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByDisk
Position: | Named |
Mandatory: | False |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DiskId
Specifies an ID used to identify a disk in the system.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | DiskPath |
Parameter sets
ById
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-DiskNumber
Specifies an array of disk numbers.
Parameter properties
Type: | UInt32[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByNumber
Position: | 0 |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-DriveLetter
Specifies a letter used to identify a drive or volume in the system. Specifically the drive on which the partition resides.
Parameter properties
Type: | Char[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByDriveLetter
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Offset
Specifies the starting offset, in bytes.
Parameter properties
Type: | UInt64[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ById
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-PartitionNumber
Specifies the number of the partition.
Parameter properties
Type: | UInt32[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | Number |
Parameter sets
ByNumber
Position: | 1 |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-StorageSubSystem
Specifies the storage subsystem from which to get partitions. To obtain a StorageSubsystem object, use the Get-StorageSubSystem cmdlet.
Parameter properties
Type: | CimInstance |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByStorageSubSystem
Position: | Named |
Mandatory: | False |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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.
Parameter properties
Type: | Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-UniqueId
Specifies the ID of the partition to get.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByUniqueId
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Volume
Accepts a Volume object as input. The Volume CIM object is exposed by the Get-Volume cmdlet.
Parameter properties
Type: | CimInstance |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByVolume
Position: | Named |
Mandatory: | False |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
CimInstance
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.
CimInstance
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.
CimInstance
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.
Outputs
CimInstance
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.
Notes
- When used in Failover Cluster, cmdlets from the Storage module operate on cluster level (all servers in the cluster).