The Set-Partition cmdlet sets the attributes of a partition, including active, read-only, hidden, offline, and the drive letter.
Examples
Example 1: Set the partition to read-only
PS C:\> Set-Partition -DriveLetter Y -IsReadOnly $True
This example makes partition Y read-only.
Example 2: Set an MBR partition to active
PS C:\> Set-Partition -DriveLetter Y -IsActive $True
This example makes the MBR partition Y active.
Example 3: Hide the partition
PS C:\> Set-Partition -DriveLetter Y -IsHidden $True
This example hides partition Y.
Example 4: Take the partition offline
PS C:\> Set-Partition -DriveLetter Y -IsOffline $True
This example takes the partition and volume offline.
Example 5: Change the drive letter
PS C:\> Set-Partition -DriveLetter Y -NewDriveLetter Z
This example changes the drive letter from Y to Z.
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
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type:
SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Aliases:
cf
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DiskId
Specifies the disk ID of the partition to modify.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByIdAttributes
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
ByIdAccessPath
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
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.
These represent the disks on which the partitions reside to modify.
Parameter properties
Type:
UInt32
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
0
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
ByNumberAccessPath
Position:
0
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
ByNumber
Position:
0
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-DriveLetter
Specifies the drive letter of the partition to modify.
Parameter properties
Type:
Char
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByDriveLetterAttributes
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
ByDriveLetterAccessPath
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
ByDriveLetter
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
-GptType
Sets the type of a GPT partition to a specific GUID.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-InputObject
Specifies the input object that is used in a pipeline command.
Parameter properties
Type:
CimInstance[]
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByObjectAccessPath
Position:
Named
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObject
Position:
Named
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-IsActive
Specifies that the partition is marked as active and can be used to start the system.
This parameter is only relevant for MBR disks.
Parameter properties
Type:
Boolean
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-IsDAX
Formats a volume as a DirectAccess (DAX) volume.
DAX provides applications with direct access and byte-addressability options via memory mapping on storage class memory (SCM) devices, such as NVDIMM-N.
If you do not specify the IsDAX parameter, the cmdlet defaults to a regular, non-DAX volume.
Parameter properties
Type:
Boolean
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-IsHidden
Specifies that the partition is hidden.
As a result, the partition does not receive a drive letter, does not receive a volume GUID path, and does not host volume mount points.
This ensures that applications such as disk defragmenter do not access the partition.
Parameter properties
Type:
Boolean
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-IsOffline
Takes the partition offline until explicitly brought back online, or until an access path is added to the partition.
Parameter properties
Type:
Boolean
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByObject
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ById
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetter
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByNumber
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-IsReadOnly
Sets the partition to be read-only (IsReadOnly $true) or read-write (IsReadOnly $false).
Parameter properties
Type:
Boolean
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-IsShadowCopy
The Set-Partition cmdlet sets the attributes of a partition, including active, read-only, hidden, offline, and the drive letter.
Parameter properties
Type:
Boolean
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-MbrType
Sets the type of an MBR partition to a specific numeric ID.
Parameter properties
Type:
UInt16
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-NewDriveLetter
Specifies the new drive letter for the partition.
Parameter properties
Type:
Char
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByObjectAccessPath
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAccessPath
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAccessPath
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByNumberAccessPath
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-NoDefaultDriveLetter
Specifies that the automatic assignment of a drive letter is disabled.
This is only honored for GPT disks.
This attribute is useful in storage area network (SAN) environments.
Parameter properties
Type:
Boolean
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByNumberAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByObjectAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByDriveLetterAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByIdAttributes
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Offset
Specifies the partition's offset from the beginning of the disk, measured in bytes.
Parameter properties
Type:
UInt64
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByIdAttributes
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
ByIdAccessPath
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
True
Value from remaining arguments:
False
ById
Position:
Named
Mandatory:
True
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
ByNumberAttributes
Position:
1
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByNumberAccessPath
Position:
1
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
ByNumber
Position:
1
Mandatory:
True
Value from pipeline:
False
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
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type:
SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Aliases:
wi
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
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.