PowerShell Commands

Set-Disk

Set-Disk [-Number*] <UInt32> [-CimSession <CimSession[]>] [-Guid <String>] [-IsReadOnly <Boolean>] [-Signature<UInt32>] [-ThrottleLimit <Int32>] [<CommonParameters>]
Set-Disk [-Number*] <UInt32> [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>][<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] -Path* <String>[<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-PartitionStyle {Unknown | MBR | GPT}] [-ThrottleLimit <Int32>][<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-Guid <String>] [-IsReadOnly <Boolean>] [-Signature <UInt32>][-ThrottleLimit <Int32>] -Path* <String> [<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-Guid <String>] [-IsReadOnly <Boolean>] [-Signature <UInt32>][-ThrottleLimit <Int32>] -UniqueId* <String> [<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-Guid <String>] [-IsReadOnly <Boolean>] [-Signature <UInt32>][-ThrottleLimit <Int32>] [<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] -UniqueId* <String>[<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-IsOffline <Boolean>] [-ThrottleLimit <Int32>] [<CommonParameters>]
Set-Disk [-Number*] <UInt32> [-CimSession <CimSession[]>] [-PartitionStyle {Unknown | MBR | GPT}] [-ThrottleLimit<Int32>] [<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-PartitionStyle {Unknown | MBR | GPT}] [-ThrottleLimit <Int32>] -Path*<String> [<CommonParameters>]
Set-Disk [-CimSession <CimSession[]>] [-PartitionStyle {Unknown | MBR | GPT}] [-ThrottleLimit <Int32>] -UniqueId*<String> [<CommonParameters>]

The Set-Disk cmdlet takes a Disk object or unique disk identifiers and a set of attributes, and updates the physical disk on the system.

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.

-Guid [<String>]

Contains a globally unique ID (GUID).

-IsOffline [<Boolean>]

Specifies that the disk is offline.

-IsReadOnly [<Boolean>]

Sets 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 <UInt32>

  • This value is required
  • Accepts pipeline input ByPropertyName

Specifies a disk number on which the cmdlet acts.

-PartitionStyle [<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 theInitialize-Disk cmdlet) and set to read-write (IsReadOnly $false) before this cmdlet will work. The disk must be set to read-only = false before this cmdlet will work.

-Path <String>

  • This value is required
  • Accepts pipeline input ByPropertyName

Contains the device instance path.

-Signature [<UInt32>]

Contains the signature of the disk.

-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 PowerShellr 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 <String>

  • This value is required
  • Accepts pipeline input ByPropertyName

Specifies an ID used to uniquely identify a Disk object in the system. The ID persists through restarts.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Inputs
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk
http://msdn.microsoft.com/library/windows/desktop/hh830493.aspx 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.
Outputs
None
EXAMPLE 1 PS C:\>Set-Disk -Number 5 -IsOffline $False This example takes a disk that is offline and makes it online. EXAMPLE 2 PS C:\>Set-Disk -Number 5 -IsReadonly $False This example takes a disk that is read-only and makes it writeable.

    This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

    PowerShell Commands