Set-Volume

Sets or changes the file system label of an existing volume.

Syntax

Set-Volume
   [-DriveLetter] <Char[]>
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-NewFileSystemLabel <String>]
   [-PassThru]
   [-ThrottleLimit <Int32>]
   [-Confirm]
   [-WhatIf]
Set-Volume
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-NewFileSystemLabel <String>]
   [-PassThru]
   [-ThrottleLimit <Int32>]
   -Path <String[]>
   [-Confirm]
   [-WhatIf]
Set-Volume
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-NewFileSystemLabel <String>]
   [-PassThru]
   [-ThrottleLimit <Int32>]
   -ObjectId <String[]>
   [-Confirm]
   [-WhatIf]
Set-Volume
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-NewFileSystemLabel <String>]
   [-PassThru]
   [-ThrottleLimit <Int32>]
   -InputObject <CimInstance[]>
   [-Confirm]
   [-WhatIf]
Set-Volume
   [-AsJob]
   [-CimSession <CimSession[]>]
   [-NewFileSystemLabel <String>]
   [-PassThru]
   [-ThrottleLimit <Int32>]
   -FileSystemLabel <String[]>
   [-Confirm]
   [-WhatIf]

Description

The Set-Volume cmdlet sets or changes the file system label of an existing volume.

This cmdlet returns either Success or Failure and corresponding error code as follows.

Type: Volume Name: Vol Remarks: InputObj

Type: String [] Name: Pathname Remarks: Wildcards disabled

Type: String [] Name: DriveLetter Remarks: InputObj

Type: String [] Name: FileSystemLabel Remarks: New Label

Examples

EXAMPLE 1

PS C:\>Set-Volume -FileSystemLabel "Test" -NewFileSystemLabel "TestData"

This example changes the file system label from test to TestData.

EXAMPLE 2

PS C:\>Format-Volume -InputObject $PartitionObject -FileSystem NTFS -NewFileSystemLabel "TestData" -ClusterSize (8K) -ShortFileNameSupport $False

This example uses the specified Partition object as an input to format the volume on this partition with the NTFS file system, using the file system label testdata with a cluster size of 8K, and with short filename support disabled.

Required Parameters

-DriveLetter

Specifies a letter used to identify a drive or volume in the system.

Type:Char[]
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-FileSystemLabel

Specifies the file system label of the object. The acceptable values for this parameter include: NTFS and ReFS.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-InputObject

Accepts an object from the pipeline as input.

Type:CimInstance[]
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ObjectId

Specifies an ID representing the object. The ID is not globally unique.

Type:String[]
Aliases:Id
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Path

Contains valid path information.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-AsJob

ps_cimcommon_asjob

Type:SwitchParameter
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-NewFileSystemLabel

Specifies a new file system label to be used.

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

Sends items from the interactive window down the pipeline as input to other cmdlets. By default, this cmdlet does not generate any output.

To send items from the interactive window down the pipeline, click to select the items and then click OK. Shift-click and Ctrl-click are supported.

Type:SwitchParameter
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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

Inputs

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Partition

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.

Inputs

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Volume

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

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Partition

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

Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Volume

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.