Skip to content
PowerShell Commands

Repair-Volume

Repair-Volume [-DriveLetter*] <Char[]> [-CimSession <CimSession[]>] [-OfflineScanAndFix] [-Scan] [-SpotFix][-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Repair-Volume [-CimSession <CimSession[]>] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit <Int32>][-Confirm] [-WhatIf] [<CommonParameters>]
Repair-Volume [-CimSession <CimSession[]>] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit <Int32>] -Path*<String[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Repair-Volume [-CimSession <CimSession[]>] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit <Int32>]-FileSystemLabel* <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Repair-Volume [-CimSession <CimSession[]>] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit <Int32>]-ObjectId* <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]

The Repair-Volume cmdlet performs repairs on a volume. The following repair actions are available:

OfflineScanAndFix: Takes the volume offline to scan the volume and fix any errors found (equivalent to chkdsk /f).

Scan: Scans the volume without attempting to repair it; all detected corruptions are added to the $corrupt system file (equivalent to chkdsk /scan).

SpotFix: Takes the volume briefly offline and then fixes only issues that are logged in the $corrupt file (equivalent to chkdsk /spotfix).

Parameters

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

-DriveLetter <Char[]>

  • This value is required
  • Accepts pipeline input ByPropertyName

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

-FileSystemLabel <String[]>

  • This value is required
  • Accepts pipeline input ByPropertyName

Specifies the volume to scan based on the file system label (the volume name).

-ObjectId <String[]>

  • This value is required
  • Accepts pipeline input ByPropertyName

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

-OfflineScanAndFix [<SwitchParameter>]

Performs and offline scan and fix of any errors found in the file system.

-Path <String[]>

  • This value is required
  • Accepts pipeline input ByPropertyName

Contains valid path information.

-Scan [<SwitchParameter>]

Scans the volume.

-SpotFix [<SwitchParameter>]

Takes the volume offline and fixes any issues that are logged in the $corrupt file.

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

-Confirm [<SwitchParameter>]

  • Default value is false

Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.

-WhatIf [<SwitchParameter>]

  • Default value is false

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

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Inputs
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Volume
http://msdn.microsoft.com/library/windows/desktop/hh830604.aspx 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
System.UInt32
EXAMPLE 1 PS C:\>Repair-Volume -DriveLetter H -Scan This example scans drive H and reports errors only. EXAMPLE 2 PS C:\>Repair-Volume -DriveLetter H -OfflineScanAndFix This example takes drive H offline, and fixes all issues. EXAMPLE 3 PS C:\>Repair-Volume -DriveLetter H -SpotFix This example uses the spot verifier functionality to quickly fix drive H.

    This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

    PowerShell Commands