Set-Partition
Syntax
Set-Partition
[-IsReadOnly <Boolean>]
[-NoDefaultDriveLetter <Boolean>]
[-IsActive <Boolean>]
[-IsHidden <Boolean>]
[-IsShadowCopy <Boolean>]
[-IsDAX <Boolean>]
[-MbrType <UInt16>]
[-GptType <String>]
[-DiskNumber] <UInt32>
[-PartitionNumber] <UInt32>
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
-InputObject <CimInstance[]>
[-NewDriveLetter <Char>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
-InputObject <CimInstance[]>
[-IsOffline <Boolean>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
-InputObject <CimInstance[]>
[-IsReadOnly <Boolean>]
[-NoDefaultDriveLetter <Boolean>]
[-IsActive <Boolean>]
[-IsHidden <Boolean>]
[-IsShadowCopy <Boolean>]
[-IsDAX <Boolean>]
[-MbrType <UInt16>]
[-GptType <String>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
[-IsReadOnly <Boolean>]
[-NoDefaultDriveLetter <Boolean>]
[-IsActive <Boolean>]
[-IsHidden <Boolean>]
[-IsShadowCopy <Boolean>]
[-IsDAX <Boolean>]
[-MbrType <UInt16>]
[-GptType <String>]
-DriveLetter <Char>
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
[-IsReadOnly <Boolean>]
[-NoDefaultDriveLetter <Boolean>]
[-IsActive <Boolean>]
[-IsHidden <Boolean>]
[-IsShadowCopy <Boolean>]
[-IsDAX <Boolean>]
[-MbrType <UInt16>]
[-GptType <String>]
-DiskId <String>
-Offset <UInt64>
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
-DiskId <String>
-Offset <UInt64>
[-NewDriveLetter <Char>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
-DiskId <String>
-Offset <UInt64>
[-IsOffline <Boolean>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
-DriveLetter <Char>
[-NewDriveLetter <Char>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
-DriveLetter <Char>
[-IsOffline <Boolean>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
[-DiskNumber] <UInt32>
[-PartitionNumber] <UInt32>
[-NewDriveLetter <Char>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-Partition
[-DiskNumber] <UInt32>
[-PartitionNumber] <UInt32>
[-IsOffline <Boolean>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
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.
Required Parameters
Specifies the disk ID of the partition to modify.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies an array of disk numbers. These represent the disks on which the partitions reside to modify.
Type: | UInt32 |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies the drive letter of the partition to modify.
Type: | Char |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies the input object that is used in a pipeline command.
Type: | CimInstance[] |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByValue) |
Accept wildcard characters: | False |
Specifies the partition's offset from the beginning of the disk, measured in bytes.
Type: | UInt64 |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies the number of the partition.
Type: | UInt32 |
Aliases: | Number |
Position: | 1 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Optional Parameters
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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.
Type: | CimSession[] |
Aliases: | Session |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Sets the type of a GPT partition to a specific GUID.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies that the partition is marked as active and can be used to start the system. This parameter is only relevant for MBR disks.
Type: | Boolean |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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.
Type: | Boolean |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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.
Type: | Boolean |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Takes the partition offline until explicitly brought back online, or until an access path is added to the partition.
Type: | Boolean |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Sets the partition to be read-only (
IsReadOnly $true
) or read-write (
IsReadOnly $false
).
Type: | Boolean |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Type: | Boolean |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Sets the type of an MBR partition to a specific numeric ID.
Type: | UInt16 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the new drive letter for the partition.
Type: | Char |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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.
Type: | Boolean |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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 |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Partition
You can pipe a Partition object to the InputObject parameter to specify the partition you want to modify by Partition object.
Outputs
None