< Back
Set-Partition
Post
NAME Set-Partition
SYNOPSIS
Sets attributes of a partition, such as active, read-only, and offline states.
SYNTAX
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-CimSession <CimSession[]>] [-GptType <System.String>] [-IsActive <Boolean>] [-IsDAX]
[-IsHidden <Boolean>] [-IsReadOnly <Boolean>] [-IsShadowCopy] [-MbrType <System.UInt16>] [-NoDefaultDriveLetter <Boolean>] [-ThrottleLimit <Int32>]
[-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] [-Confirm]
[-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] -DriveLetter <Char> [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-GptType <System.String>] [-IsActive <Boolean>] [-IsDAX] [-IsHidden <Boolean>] [-IsReadOnly <Boolean>]
[-IsShadowCopy] [-MbrType <System.UInt16>] [-NoDefaultDriveLetter <Boolean>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-NewDriveLetter <Char>] [-ThrottleLimit <Int32>] -DriveLetter <Char> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-NewDriveLetter <Char>] [-ThrottleLimit <Int32>] -DiskId <String> -Offset <UInt64> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-NewDriveLetter <Char>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-CimSession <CimSession[]>] [-NewDriveLetter <Char>] [-ThrottleLimit <Int32>]
[-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] -DiskId <String> -Offset <UInt64> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-GptType <System.String>] [-IsActive <Boolean>] [-IsDAX] [-IsHidden <Boolean>] [-IsReadOnly <Boolean>]
[-IsShadowCopy] [-MbrType <System.UInt16>] [-NoDefaultDriveLetter <Boolean>] [-ThrottleLimit <Int32>] -DriveLetter <Char> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-GptType <System.String>] [-IsActive <Boolean>] [-IsDAX] [-IsHidden <Boolean>] [-IsReadOnly <Boolean>]
[-IsShadowCopy] [-MbrType <System.UInt16>] [-NoDefaultDriveLetter <Boolean>] [-ThrottleLimit <Int32>] -DiskId <String> -Offset <UInt64> [-Confirm]
[-WhatIf] [<CommonParameters>]
DESCRIPTION
The Set-Partition cmdlet sets the attributes of a partition, including active, read-only, hidden, offline, and the drive letter.
PARAMETERS
-CimSession [<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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-DiskId <String>
Specifies the disk ID of the partition to modify.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-DiskNumber <UInt32>
Specifies an array of disk numbers. These represent the disks on which the partitions reside to modify.
Required? true
Position? 1
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-DriveLetter <Char>
Specifies the drive letter of the partition to modify.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-GptType [<System.String>]
Sets the type of a GPT partition to a specific GUID.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsActive [<Boolean>]
Specifies that the partition is marked as active and can be used to start the system. This parameter is only relevant for MBR disks.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsDAX [<SwitchParameter>]
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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsHidden [<Boolean>]
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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsOffline [<Boolean>]
Takes the partition offline until explicitly brought back online, or until an access path is added to the partition.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsReadOnly [<Boolean>]
Sets the partition to be read-only (IsReadOnly $true) or read-write (IsReadOnly $false).
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsShadowCopy [<SwitchParameter>]
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-MbrType [<System.UInt16>]
Sets the type of an MBR partition to a specific numeric ID.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-NewDriveLetter [<Char>]
Specifies the new drive letter for the partition.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-NoDefaultDriveLetter [<Boolean>]
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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Offset <UInt64>
Specifies the partition's offset from the beginning of the disk, measured in bytes.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-PartitionNumber <UInt32>
Specifies the number of the partition.
Required? true
Position? 2
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-ThrottleLimit [<Int32>]
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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Partition
http://msdn.microsoft.com/library/windo ... 30524.aspx
You can pipe a Partition object to the InputObject parameter to specify the partition you want to modify by Partition object.
OUTPUTS
None
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.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=816482
Get-Partition
New-Partition
SYNOPSIS
Sets attributes of a partition, such as active, read-only, and offline states.
SYNTAX
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-CimSession <CimSession[]>] [-GptType <System.String>] [-IsActive <Boolean>] [-IsDAX]
[-IsHidden <Boolean>] [-IsReadOnly <Boolean>] [-IsShadowCopy] [-MbrType <System.UInt16>] [-NoDefaultDriveLetter <Boolean>] [-ThrottleLimit <Int32>]
[-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] [-Confirm]
[-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] -DriveLetter <Char> [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-GptType <System.String>] [-IsActive <Boolean>] [-IsDAX] [-IsHidden <Boolean>] [-IsReadOnly <Boolean>]
[-IsShadowCopy] [-MbrType <System.UInt16>] [-NoDefaultDriveLetter <Boolean>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-NewDriveLetter <Char>] [-ThrottleLimit <Int32>] -DriveLetter <Char> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-NewDriveLetter <Char>] [-ThrottleLimit <Int32>] -DiskId <String> -Offset <UInt64> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-NewDriveLetter <Char>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-CimSession <CimSession[]>] [-NewDriveLetter <Char>] [-ThrottleLimit <Int32>]
[-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] -DiskId <String> -Offset <UInt64> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-GptType <System.String>] [-IsActive <Boolean>] [-IsDAX] [-IsHidden <Boolean>] [-IsReadOnly <Boolean>]
[-IsShadowCopy] [-MbrType <System.UInt16>] [-NoDefaultDriveLetter <Boolean>] [-ThrottleLimit <Int32>] -DriveLetter <Char> [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-Partition [-CimSession <CimSession[]>] [-GptType <System.String>] [-IsActive <Boolean>] [-IsDAX] [-IsHidden <Boolean>] [-IsReadOnly <Boolean>]
[-IsShadowCopy] [-MbrType <System.UInt16>] [-NoDefaultDriveLetter <Boolean>] [-ThrottleLimit <Int32>] -DiskId <String> -Offset <UInt64> [-Confirm]
[-WhatIf] [<CommonParameters>]
DESCRIPTION
The Set-Partition cmdlet sets the attributes of a partition, including active, read-only, hidden, offline, and the drive letter.
PARAMETERS
-CimSession [<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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-DiskId <String>
Specifies the disk ID of the partition to modify.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-DiskNumber <UInt32>
Specifies an array of disk numbers. These represent the disks on which the partitions reside to modify.
Required? true
Position? 1
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-DriveLetter <Char>
Specifies the drive letter of the partition to modify.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-GptType [<System.String>]
Sets the type of a GPT partition to a specific GUID.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsActive [<Boolean>]
Specifies that the partition is marked as active and can be used to start the system. This parameter is only relevant for MBR disks.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsDAX [<SwitchParameter>]
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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsHidden [<Boolean>]
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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsOffline [<Boolean>]
Takes the partition offline until explicitly brought back online, or until an access path is added to the partition.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsReadOnly [<Boolean>]
Sets the partition to be read-only (IsReadOnly $true) or read-write (IsReadOnly $false).
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-IsShadowCopy [<SwitchParameter>]
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-MbrType [<System.UInt16>]
Sets the type of an MBR partition to a specific numeric ID.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-NewDriveLetter [<Char>]
Specifies the new drive letter for the partition.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-NoDefaultDriveLetter [<Boolean>]
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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Offset <UInt64>
Specifies the partition's offset from the beginning of the disk, measured in bytes.
Required? true
Position? named
Default value none
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-PartitionNumber <UInt32>
Specifies the number of the partition.
Required? true
Position? 2
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-ThrottleLimit [<Int32>]
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.
Required? false
Position? named
Default value none
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Partition
http://msdn.microsoft.com/library/windo ... 30524.aspx
You can pipe a Partition object to the InputObject parameter to specify the partition you want to modify by Partition object.
OUTPUTS
None
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.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=816482
Get-Partition
New-Partition