Format-Volume

Formats one or more existing volumes or a new volume on an existing partition.

Syntax

Format-Volume
      [-DriveLetter] <Char[]>
      [-FileSystem <String>]
      [-NewFileSystemLabel <String>]
      [-AllocationUnitSize <UInt32>]
      [-Full]
      [-Force]
      [-Compress]
      [-ShortFileNameSupport <Boolean>]
      [-SetIntegrityStreams <Boolean>]
      [-UseLargeFRS]
      [-DisableHeatGathering]
      [-CimSession <CimSession[]>]
      [-ThrottleLimit <Int32>]
      [-AsJob]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Format-Volume
      -ObjectId <String[]>
      [-FileSystem <String>]
      [-NewFileSystemLabel <String>]
      [-AllocationUnitSize <UInt32>]
      [-Full]
      [-Force]
      [-Compress]
      [-ShortFileNameSupport <Boolean>]
      [-SetIntegrityStreams <Boolean>]
      [-UseLargeFRS]
      [-DisableHeatGathering]
      [-CimSession <CimSession[]>]
      [-ThrottleLimit <Int32>]
      [-AsJob]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Format-Volume
      -Path <String[]>
      [-FileSystem <String>]
      [-NewFileSystemLabel <String>]
      [-AllocationUnitSize <UInt32>]
      [-Full]
      [-Force]
      [-Compress]
      [-ShortFileNameSupport <Boolean>]
      [-SetIntegrityStreams <Boolean>]
      [-UseLargeFRS]
      [-DisableHeatGathering]
      [-CimSession <CimSession[]>]
      [-ThrottleLimit <Int32>]
      [-AsJob]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Format-Volume
      -FileSystemLabel <String[]>
      [-FileSystem <String>]
      [-NewFileSystemLabel <String>]
      [-AllocationUnitSize <UInt32>]
      [-Full]
      [-Force]
      [-Compress]
      [-ShortFileNameSupport <Boolean>]
      [-SetIntegrityStreams <Boolean>]
      [-UseLargeFRS]
      [-DisableHeatGathering]
      [-CimSession <CimSession[]>]
      [-ThrottleLimit <Int32>]
      [-AsJob]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Format-Volume
      [-Partition <CimInstance>]
      [-FileSystem <String>]
      [-NewFileSystemLabel <String>]
      [-AllocationUnitSize <UInt32>]
      [-Full]
      [-Force]
      [-Compress]
      [-ShortFileNameSupport <Boolean>]
      [-SetIntegrityStreams <Boolean>]
      [-UseLargeFRS]
      [-DisableHeatGathering]
      [-CimSession <CimSession[]>]
      [-ThrottleLimit <Int32>]
      [-AsJob]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Format-Volume
      -InputObject <CimInstance[]>
      [-FileSystem <String>]
      [-NewFileSystemLabel <String>]
      [-AllocationUnitSize <UInt32>]
      [-Full]
      [-Force]
      [-Compress]
      [-ShortFileNameSupport <Boolean>]
      [-SetIntegrityStreams <Boolean>]
      [-UseLargeFRS]
      [-DisableHeatGathering]
      [-CimSession <CimSession[]>]
      [-ThrottleLimit <Int32>]
      [-AsJob]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Format-Volume cmdlet formats one or more existing volumes, or a new volume on an existing partition. This cmdlet returns the object representing the volume that was just formatted, with all properties updated to reflect the format operation.

To create a new volume, use this cmdlet in conjunction with the Initialize-Disk and New-Partition cmdlets.

Examples

Example 1: Quick format

PS C:\>Format-Volume -DriveLetter D

This example performs a format of the D volume.

Example 2: Full format using FAT32

PS C:\>Format-Volume -DriveLetter D -FileSystem FAT32 -Full -Force

This example performs a full format of the D volume using the FAT32 file system.

Example 3: Full format using NTFS and allocation size 8192

PS C:\> Format-Volume -DriveLetter D -FileSystem NTFS -AllocationUnitSize 8192

This example performs a full format of the D volume using the NTFS file system and allocation size 8192.

Parameters

-AllocationUnitSize

Specifies the allocation unit size to use when formatting the volume.

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

-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

-Compress

Enables compression on all files and folders created on the specified NTFS volume.

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

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DisableHeatGathering

Indicates that the cmdlet does not gather file activity on the specified tiered volume. You can override file placement based on the desired storage tier. This parameter is only valid for tiered volumes.

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

-DriveLetter

Specifies the drive letter of the volume to format.

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

-FileSystem

Specifies the file system with which to format the volume. The acceptable values for this parameter are:NTFS, ReFS, exFAT, FAT32, and FAT.

Type:String
Accepted values:FAT, FAT32, exFAT, NTFS, ReFS
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FileSystemLabel

Specifies the label to use for the volume.

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

-Force

Specifies the override switch.

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

-Full

Performs a full format. A full format writes to every sector of the disk, takes much longer to perform than the default (quick) format, and is not recommended on storage that is thinly provisioned.

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

-InputObject

Specifies one or more existing Volume objects to format. Enter one or more Volume CIM objects, which is output by the Get-Volume cmdlet.

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

-NewFileSystemLabel

Specifies a new label to use for the volume.

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

-ObjectId

Specifies the ID of the volume to format.

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

-Partition

Specifies the partition object on which to create the new volume. Enter a Partition CIM object, which is exposed by the Get-Partition and New-Partition cmdlets.

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

-Path

Specifies the path of the volume to format.

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

-SetIntegrityStreams

Enables integrity streams on the volume to be formatted.

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

-ShortFileNameSupport

Specifies that support for short file names should be enabled on this volume.

Type:Boolean
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

-UseLargeFRS

Specifies that large File Record Segment (FRS) should be used.

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

-WhatIf

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

NOTE: The WhatIf switch does not work with this cmdlet.

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

Inputs

CimInstance

You can use the pipeline operator to pass an MSFT_Volume object to the InputObject parameter.

CimInstance

You can use the pipeline operator to pass an MSFT_Partition object to the Partition parameter.

Outputs

CimInstance

This cmdlet returns an object that represents the newly formatted volume.