Set-Disk

Takes a Disk object or unique disk identifiers and a set of attributes, and updates the physical disk on the system.

Syntax

Set-Disk
   [-Number] <UInt32>
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-Guid <String>]
   [-IsReadOnly <Boolean>]
   [-Signature <UInt32>]
   [-ThrottleLimit <Int32>]
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-Guid <String>]
   [-IsReadOnly <Boolean>]
   [-Signature <UInt32>]
   [-ThrottleLimit <Int32>]
   -Path <String>
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-Guid <String>]
   [-IsReadOnly <Boolean>]
   [-Signature <UInt32>]
   [-ThrottleLimit <Int32>]
   -UniqueId <String>
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-Guid <String>]
   [-IsReadOnly <Boolean>]
   [-Signature <UInt32>]
   [-ThrottleLimit <Int32>]
   -InputObject <CimInstance[]>
Set-Disk
   [-Number] <UInt32>
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-IsOffline <Boolean>]
   [-ThrottleLimit <Int32>]
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-IsOffline <Boolean>]
   [-ThrottleLimit <Int32>]
   -Path <String>
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-IsOffline <Boolean>]
   [-ThrottleLimit <Int32>]
   -UniqueId <String>
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-IsOffline <Boolean>]
   [-ThrottleLimit <Int32>]
   -InputObject <CimInstance[]>
Set-Disk
   [-Number] <UInt32>
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-PartitionStyle <PartitionStyle>]
   [-ThrottleLimit <Int32>]
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-PartitionStyle <PartitionStyle>]
   [-ThrottleLimit <Int32>]
   -Path <String>
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-PartitionStyle <PartitionStyle>]
   [-ThrottleLimit <Int32>]
   -UniqueId <String>
Set-Disk
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-PartitionStyle <PartitionStyle>]
   [-ThrottleLimit <Int32>]
   -InputObject <CimInstance[]>

Description

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.

Examples

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.

Parameters

-AsJob

ps_cimcommon_asjob

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-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-CimSessionhttp://go.microsoft.com/fwlink/p/?LinkId=227967 or Get-CimSessionhttp://go.microsoft.com/fwlink/p/?LinkId=227966 cmdlet. The default is the current session on the local computer.

Type:CimSession[]
Aliases:Session
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Guid

Contains a globally unique ID (GUID).

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Accepts an object from the pipeline as input.

Type:CimInstance[]
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-IsOffline

Specifies that the disk is offline.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IsReadOnly

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.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Number

Specifies a disk number on which the cmdlet acts.

Type:UInt32
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-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-Diskhttp://technet.microsoft.com/library/e5369347-7ee0-4cb7-a063-cf1f355d095e 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.

Type:PartitionStyle
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

Contains the device instance path.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Signature

Contains the signature of the disk.

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-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 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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UniqueId

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

CimInstance

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