Set-Disk
Set-Disk
Takes a Disk object or unique disk identifiers and a set of attributes, and updates the physical disk on the system.
Syntax
Parameter Set: ByNumberAttributes
Set-Disk [-Number] <UInt32> [-AsJob] [-CimSession <CimSession[]> ] [-Guid <String> ] [-IsReadOnly <Boolean> ] [-Signature <UInt32> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ById
Set-Disk -UniqueId <String> [-AsJob] [-CimSession <CimSession[]> ] [-IsOffline <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByIdAttributes
Set-Disk -UniqueId <String> [-AsJob] [-CimSession <CimSession[]> ] [-Guid <String> ] [-IsReadOnly <Boolean> ] [-Signature <UInt32> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByIdConvertStyle
Set-Disk -UniqueId <String> [-AsJob] [-CimSession <CimSession[]> ] [-PartitionStyle <PartitionStyle> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByNumber
Set-Disk [-Number] <UInt32> [-AsJob] [-CimSession <CimSession[]> ] [-IsOffline <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByNumberConvertStyle
Set-Disk [-Number] <UInt32> [-AsJob] [-CimSession <CimSession[]> ] [-PartitionStyle <PartitionStyle> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByObject
Set-Disk -InputObject <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-IsOffline <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByObjectAttributes
Set-Disk -InputObject <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-Guid <String> ] [-IsReadOnly <Boolean> ] [-Signature <UInt32> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByObjectConvertStyle
Set-Disk -InputObject <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-PartitionStyle <PartitionStyle> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByPath
Set-Disk -Path <String> [-AsJob] [-CimSession <CimSession[]> ] [-IsOffline <Boolean> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByPathAttributes
Set-Disk -Path <String> [-AsJob] [-CimSession <CimSession[]> ] [-Guid <String> ] [-IsReadOnly <Boolean> ] [-Signature <UInt32> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Parameter Set: ByPathConvertStyle
Set-Disk -Path <String> [-AsJob] [-CimSession <CimSession[]> ] [-PartitionStyle <PartitionStyle> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]
Detailed 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.
Parameters
-AsJob
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-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.
Aliases |
Session |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Guid<String>
Contains a globally unique ID (GUID).
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-InputObject<CimInstance[]>
Accepts an object from the pipeline as input.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-IsOffline<Boolean>
Specifies that the disk is offline.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Number<UInt32>
Specifies a disk number on which the cmdlet acts.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Path<String>
Contains the device instance path.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Signature<UInt32>
Contains the signature of the disk.
Aliases |
none |
Required? |
false |
Position? |
named |
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-UniqueId<String>
Specifies an ID used to uniquely identify a Disk object in the system. The ID persists through restarts.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk
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
The output type is the type of the objects that the cmdlet emits.
- None
Examples
EXAMPLE 1
This example takes a disk that is offline and makes it online.
PS C:\> Set-Disk -Number 5 -IsOffline $False
EXAMPLE 2
This example takes a disk that is read-only and makes it writeable.
PS C:\> Set-Disk –Number 5 -IsReadonly $False