Get-Partition
Returns a list of all partition objects visible on all disks, or optionally a filtered list using specified parameters.
Syntax
Get-Partition
[[-DiskNumber] <UInt32[]>]
[[-PartitionNumber] <UInt32[]>]
[-AsJob]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
Get-Partition
[-AsJob]
[-CimSession <CimSession[]>]
[-DriveLetter <Char[]>]
[-ThrottleLimit <Int32>]
Get-Partition
[-AsJob]
[-CimSession <CimSession[]>]
[-Disk <CimInstance>]
[-ThrottleLimit <Int32>]
Get-Partition
[-AsJob]
[-CimSession <CimSession[]>]
[-DiskId <String[]>]
[-Offset <UInt64[]>]
[-ThrottleLimit <Int32>]
Get-Partition
[-AsJob]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-Volume <CimInstance>]
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
ps_cimcommon_asjob
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
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[] |
Aliases: | Session |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Disk
Accepts a Disk object as input. The Disk CIM object is exposed by the Get-Disk cmdlet.
Type: | CimInstance |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DiskId
Specifies an ID used to identify a disk in the system.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DiskNumber
Specifies the number of the disk.
Type: | UInt32[] |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DriveLetter
Specifies a letter used to identify a drive or volume in the system. Specifically the drive on which the partition resides.
Type: | Char[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Offset
Specifies the starting offset, in bytes.
Type: | UInt64[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PartitionNumber
Specifies the number of the partition.
Type: | UInt32[] |
Aliases: | Number |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
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 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Volume
Accepts a Volume object as input. The Volume CIM object is exposed by the Get-Volume cmdlet.
Type: | CimInstance |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
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.
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.
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
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.
Related Links
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for