Set-Disk

Get one or more disks visible to the operating system.

Syntax
 Set-Disk { [-Number] UInt32 | -InputObject CimInstance[] | -UniqueId String | -Path String }
 [-IsReadOnly Boolean] [-Signature UInt32] [-Guid String] [-CimSession CimSession[]]
 [-ThrottleLimit Int32] [-AsJob] [CommonParameters ]
 Set-Disk { [-Number] UInt32 | -InputObject CimInstance[] | -UniqueId String | -Path String }
 [-IsOffline Boolean] [-CimSession CimSession[]]
 [-ThrottleLimit Int32] [-AsJob] [CommonParameters ]
 Set-Disk { [-Number] UInt32 | -InputObject CimInstance[] | -UniqueId String | -Path String }
 [-PartitionStyle PartitionStyle] [-CimSession CimSession[]]
 [-ThrottleLimit Int32] [-AsJob] [CommonParameters ]
Key
 -AsJob
 Run the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
 -CimSession
 Run 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.
 -Guid
 A globally unique ID (GUID).
 -InputObject
 The input object that is used in a pipeline command.
 -IsOffline
 Specifies that the disk is offline.
 -IsReadOnly
 Set the disk to be read-only, or read-write (read-only = false).
 Note: If the disk is set to read-only, then the disk must be set to read-only = false before
 using this cmdlet to set the PartitionStyle parameter.
 -Number
 Specifies the disk number on which the cmdlet acts.
 -PartitionStyle
 Specifies the type of the partition.
 The acceptable values for this parameter are: MBR or GPT.
 The disk must be initialized (such as using the Initialize-Disk cmdlet) and set to read-write (-IsReadOnly $false)
 before this cmdlet will work.
 -Path
 Contains the device instance path.
 -Signature
 Contains the signature of the disk.
 -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 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.
 -UniqueId
 Specifies an ID used to uniquely identify a Disk object in the system. The ID persists through restarts.

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.

When used in Failover Cluster, cmdlets from the Storage module operate on cluster level (all servers in the cluster).

Examples

Take a disk that is offline and set it to be online:

PS C:\> Set-Disk -Number 5 -IsOffline $False

Take a disk that is read-only and make it writeable:

PS C:\> Set-Disk -Number 5 -IsReadonly $False

"Set your course by the stars, not by the lights of every passing ship" ~ Omar N. Bradley

Related PowerShell Cmdlets

Clear-Disk - Remove all partition information and un-initialize a disk, erasing all data.
Get-Disk - Get one or more disks visible to the operating system.
Initialize-Disk - Initialize a RAW disk for first use, this enables formatting.
Update-Disk - Update cached information about the specified Disk object only.

(追記) (追記ここまで)
Copyright © 1999-2026 SS64.com
Some rights reserved

AltStyle によって変換されたページ (->オリジナル) /