Repair-Volume

Performs repairs on a volume.

Syntax

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

Description

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

Examples

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.

Required Parameters

-DriveLetter

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

Type: Char[]
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-FileSystemLabel

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

Type: String[]
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-InputObject

Specifies the input object that is used in a pipeline command.

Type: CimInstance[]
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-ObjectId

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

Type: String[]
Aliases: Id
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Path

Contains valid path information.

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

Optional Parameters

-AsJob

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.

Type: SwitchParameter
Position: Named
Default value: None
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-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Type: CimSession[]
Aliases: Session
Position: Named
Default value: None
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
Accept pipeline input: False
Accept wildcard characters: False
-OfflineScanAndFix

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

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

Scans the volume.

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

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

Type: SwitchParameter
Position: Named
Default value: None
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
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf

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

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

Inputs

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

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