Export (0) Print
Expand All

Format method of the Win32_Volume class

The Format method formats the volume.

This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method. The Format method, like the Defrag method, can run for a very long time. These methods are normally called asynchronously. If your code cancels the call by calling IWbemServices::CancelAsyncCall (or SWbemSink.Cancel in script or Visual Basic), then the provider is not notified and the operation continues to completion.

Syntax


uint32 Format(
  [in]  string FileSystem = "NTFS",
  [in]  boolean QuickFormat,
  [in]  uint32 ClusterSize = 4096,
  [in]  string Label = "",
  [in]  boolean EnableCompression = false
);

Parameters

FileSystem [in]

File system format to use for this volume. The default is "NTFS".

The following list identifies the possible values for this parameter.

"NTFS"

"FAT32"

"FAT"

QuickFormat [in]

If true, formats the volume with a quick format by removing files from the disk without scanning the disk for bad sectors. Use this option only if the disk has been previously formatted, and you know that the disk is not damaged. The default is false.

ClusterSize [in]

Disk allocation unit size—cluster size. All of the file systems used by this version of Windows organize the hard disk based on cluster size, which represents the smallest amount of disk space that can be allocated to hold a file. The smaller the cluster size you use, the more efficiently your disk stores information. If no cluster size is specified during format, Windows picks defaults based on the size of the volume. These defaults have been selected to reduce the amount of space lost and to reduce fragmentation. For general use, the default settings are strongly recommended.

Label [in]

Label to use for the new volume. The volume label can contain up to 11 characters for FAT and FAT32 volumes, and up to 32 characters for NTFS file system volumes.

EnableCompression [in]

Not implemented.

Return value

Return codeDescription
0

Success

1

Unsupported file system

2

Incompatible media in drive

3

Access denied

4

Call canceled

5

Call cancellation request too late

6

Volume write protected

7

Volume lock failed

8

Unable to quick format

9

Input/Output (I/O) error

10

Invalid volume label

11

No media in drive

12

Volume is too small

13

Volume is too large

14

Volume is not mounted

15

Cluster size is too small

16

Cluster size is too large

17

Cluster size is beyond 32 bits

18

Unknown error

 

Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2003

Namespace

\root\CIMV2

MOF

Vds.mof

DLL

Vdswmi.dll

See also

Win32_Volume

 

 

Community Additions

ADD
Show:
© 2014 Microsoft