Set-Partition

Set-Partition

Sets attributes of a partition, such as active, read-only, and offline states.

構文

Parameter Set: ByNumberAttributes
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-AsJob] [-CimSession <CimSession[]> ] [-IsActive <Boolean> ] [-IsHidden <Boolean> ] [-IsReadOnly <Boolean> ] [-NoDefaultDriveLetter <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByDriveLetter
Set-Partition -DriveLetter <Char> [-AsJob] [-CimSession <CimSession[]> ] [-IsOffline <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByDriveLetterAccessPath
Set-Partition -DriveLetter <Char> [-AsJob] [-CimSession <CimSession[]> ] [-NewDriveLetter <Char> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByDriveLetterAttributes
Set-Partition -DriveLetter <Char> [-AsJob] [-CimSession <CimSession[]> ] [-IsActive <Boolean> ] [-IsHidden <Boolean> ] [-IsReadOnly <Boolean> ] [-NoDefaultDriveLetter <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ById
Set-Partition -DiskId <String> -Offset <UInt64> [-AsJob] [-CimSession <CimSession[]> ] [-IsOffline <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByIdAccessPath
Set-Partition -DiskId <String> -Offset <UInt64> [-AsJob] [-CimSession <CimSession[]> ] [-NewDriveLetter <Char> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByIdAttributes
Set-Partition -DiskId <String> -Offset <UInt64> [-AsJob] [-CimSession <CimSession[]> ] [-IsActive <Boolean> ] [-IsHidden <Boolean> ] [-IsReadOnly <Boolean> ] [-NoDefaultDriveLetter <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByNumber
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-AsJob] [-CimSession <CimSession[]> ] [-IsOffline <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByNumberAccessPath
Set-Partition [-DiskNumber] <UInt32> [-PartitionNumber] <UInt32> [-AsJob] [-CimSession <CimSession[]> ] [-NewDriveLetter <Char> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByObject
Set-Partition -InputObject <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-IsOffline <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByObjectAccessPath
Set-Partition -InputObject <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-NewDriveLetter <Char> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: ByObjectAttributes
Set-Partition -InputObject <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-IsActive <Boolean> ] [-IsHidden <Boolean> ] [-IsReadOnly <Boolean> ] [-NoDefaultDriveLetter <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

詳細説明

The Set-Partition cmdlet sets the attributes of a partition, including active, read-only, hidden, offline, and the drive letter.

パラメーター

-AsJob

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-CimSession<CimSession[]>

リモート セッションまたはリモート コンピューターでコマンドレットを実行します。New-CimSession コマンドレットや Get-CimSession コマンドレットの出力など、コンピューター名またはセッション オブジェクトを入力します。既定値は、ローカル コンピューターで実行中の現在のセッションです。

エイリアス

Session

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-DiskId<String>

Specifies the disk ID of the partition to modify.

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

True (ByPropertyName)

ワイルドカード文字を許可する

false

-DiskNumber<UInt32>

Specifies the disk number of the partition to modify.

エイリアス

なし

必須?

true

位置は?

1

既定値

なし

パイプライン入力を許可する

True (ByPropertyName)

ワイルドカード文字を許可する

false

-DriveLetter<Char>

Specifies the drive letter of the partition to modify.

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

True (ByPropertyName)

ワイルドカード文字を許可する

false

-InputObject<CimInstance[]>

Specifies the Partition object to modify. Enter a Partition CIM object. The Partition object is exposed by the Get-Partition cmdlet.

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

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.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

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.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-IsOffline<Boolean>

Takes the partition offline until explicitly brought back online, or until an access path is added to the partition.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-IsReadOnly<Boolean>

Sets the partition to be read-only (IsReadOnly $true) or read-write (IsReadOnly $false).

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-NewDriveLetter<Char>

Specifies the new drive letter for the partition.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

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.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Offset<UInt64>

Specifies the partition's offset from the beginning of the disk, measured in bytes.

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

True (ByPropertyName)

ワイルドカード文字を許可する

false

-PartitionNumber<UInt32>

Specifies the number of the partition.

エイリアス

Number

必須?

true

位置は?

2

既定値

なし

パイプライン入力を許可する

True (ByPropertyName)

ワイルドカード文字を許可する

false

-ThrottleLimit<Int32>

このコマンドレットを実行するために確立できる最大同時操作数を指定します。このパラメーターを省略するか、値として 0 を入力した場合、Windows PowerShell® では、コンピューターで実行している CIM コマンドレットの数に基づいて、コマンドレットに対する最適なスロットル制限を計算します。スロットル制限は現在のコマンドレットのみに適用され、セッションまたはコンピューターには適用されません。

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

  • None

  • Microsoft.Management.Infrastructure.CimInstance オブジェクトは、Windows Management Instrumentation (WMI) オブジェクトを表示するラッパー クラスです。シャープ記号 (#) の後のパスは、基になる WMI オブジェクトの名前空間とクラス名です。

Example 1: Set the partition to read-only

This example makes partition Y read-only.

PS C:\> Set-Partition -DriveLetter Y -IsReadOnly $True

Example 2: Set an MBR partition to active

This example makes the MBR partition Y active.

PS C:\> Set-Partition -DriveLetter Y -IsActive $True

Example 3: Hide the partition

This example hides partition Y.

PS C:\> Set-Partition -DriveLetter Y -IsHidden $True

Example 4: Take the partition offline

This example takes the partition and volume offline.

PS C:\> Set-Partition -DriveLetter Y -IsOffline $True

Example 5: Change the drive letter

This example changes the drive letter from Y to Z.

PS C:\> Set-Partition -DriveLetter Y -NewDriveLetter Z

関連トピック

Get-Partition

New-Partition