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 code | Description |
---|---|
|
Success |
|
Unsupported file system |
|
Incompatible media in drive |
|
Access denied |
|
Call canceled |
|
Call cancellation request too late |
|
Volume write protected |
|
Volume lock failed |
|
Unable to quick format |
|
Input/Output (I/O) error |
|
Invalid volume label |
|
No media in drive |
|
Volume is too small |
|
Volume is too large |
|
Volume is not mounted |
|
Cluster size is too small |
|
Cluster size is too large |
|
Cluster size is beyond 32 bits |
|
Unknown error |
Requirements
Minimum supported client |
None supported |
Minimum supported server |
Windows Server 2003 |
Namespace |
Root\CIMV2 |
MOF |
|
DLL |
|