Compartilhar via


Format-Volume

Format-Volume

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

Syntax

Parameter Set: ByDriveLetter
Format-Volume [-DriveLetter] <Char[]> [-AllocationUnitSize <UInt32> ] [-AsJob] [-CimSession <CimSession[]> ] [-Compress] [-FileSystem <String> ] [-Force] [-Full] [-NewFileSystemLabel <String> ] [-SetIntegrityStreams <Boolean> ] [-ShortFileNameSupport <Boolean> ] [-ThrottleLimit <Int32> ] [-UseLargeFRS] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ById
Format-Volume -ObjectId <String[]> [-AllocationUnitSize <UInt32> ] [-AsJob] [-CimSession <CimSession[]> ] [-Compress] [-FileSystem <String> ] [-Force] [-Full] [-NewFileSystemLabel <String> ] [-SetIntegrityStreams <Boolean> ] [-ShortFileNameSupport <Boolean> ] [-ThrottleLimit <Int32> ] [-UseLargeFRS] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByLabel
Format-Volume -FileSystemLabel <String[]> [-AllocationUnitSize <UInt32> ] [-AsJob] [-CimSession <CimSession[]> ] [-Compress] [-FileSystem <String> ] [-Force] [-Full] [-NewFileSystemLabel <String> ] [-SetIntegrityStreams <Boolean> ] [-ShortFileNameSupport <Boolean> ] [-ThrottleLimit <Int32> ] [-UseLargeFRS] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByPartition
Format-Volume [-AllocationUnitSize <UInt32> ] [-AsJob] [-CimSession <CimSession[]> ] [-Compress] [-FileSystem <String> ] [-Force] [-Full] [-NewFileSystemLabel <String> ] [-Partition <CimInstance> ] [-SetIntegrityStreams <Boolean> ] [-ShortFileNameSupport <Boolean> ] [-ThrottleLimit <Int32> ] [-UseLargeFRS] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByPaths
Format-Volume -Path <String[]> [-AllocationUnitSize <UInt32> ] [-AsJob] [-CimSession <CimSession[]> ] [-Compress] [-FileSystem <String> ] [-Force] [-Full] [-NewFileSystemLabel <String> ] [-SetIntegrityStreams <Boolean> ] [-ShortFileNameSupport <Boolean> ] [-ThrottleLimit <Int32> ] [-UseLargeFRS] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: InputObject (cdxml)
Format-Volume -InputObject <CimInstance[]> [-AllocationUnitSize <UInt32> ] [-AsJob] [-CimSession <CimSession[]> ] [-Compress] [-FileSystem <String> ] [-Force] [-Full] [-NewFileSystemLabel <String> ] [-SetIntegrityStreams <Boolean> ] [-ShortFileNameSupport <Boolean> ] [-ThrottleLimit <Int32> ] [-UseLargeFRS] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed 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.

Parameters

-AllocationUnitSize<UInt32>

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

Aliases

ClusterSize

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-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

-Compress

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DriveLetter<Char[]>

Specifies the drive letter of the volume to format.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-FileSystem<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FileSystemLabel<String[]>

Specifies the label to use for the volume.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Force

Specifies the override switch.

Aliases

none

Required?

false

Position?

named

Default Value

none

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InputObject<CimInstance[]>

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

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-NewFileSystemLabel<String>

Specifies a new label to use for the volume.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ObjectId<String[]>

Specifies the ID of the volume to format.

Aliases

Id

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Partition<CimInstance>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Path<String[]>

Specifies the path of the volume to format.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SetIntegrityStreams<Boolean>

Enables integrity streams on the volume to be formatted.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ShortFileNameSupport<Boolean>

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

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

-UseLargeFRS

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

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_Volume

    You can pipe an MSFT_Volume object to the InputObject parameter.

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

    You can pipe an MSFT_Partition object to the Partition parameter.

Outputs

The output type is the type of the objects that the cmdlet emits.

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

    The Format-Volume cmdlet return an object representing the newly formatted volume.

Notes

  • 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.

Examples

Example 1: Quick format

This example performs a format of the D volume.

PS C:\> Format-Volume -DriveLetter D

Example 2: Full format using FAT32

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

PS C:\> Format-Volume -DriveLetter C -FileSystem FAT32 -FullFormat –Force

Get-Disk

Initialize-Disk

New-Partition

Get-Partition

Get-Volume

Optimize-Volume

Repair-Volume

Set-Volume