Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Repair-Volume

Repair-Volume

volume.cdxml

Synopsis

Performs repairs on a volume.

Syntax

Repair-Volume [-DriveLetter] [-AsJob] [-CimSession] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit] [-Confirm] [-WhatIf] [<CommonParameters>]

Repair-Volume [-AsJob] [-CimSession] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit] [-Path] [-Confirm] [-WhatIf] [<CommonParameters>]

Repair-Volume [-AsJob] [-CimSession] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit] [-FileSystemLabel] [-Confirm] [-WhatIf] [<CommonParameters>]

Repair-Volume [-AsJob] [-CimSession] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit] [-InputObject] [-Confirm] [-WhatIf] [<CommonParameters>]

Repair-Volume [-AsJob] [-CimSession] [-OfflineScanAndFix] [-Scan] [-SpotFix] [-ThrottleLimit] [-ObjectId] [-Confirm] [-WhatIf] [<CommonParameters>]

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

Parameters

-AsJob <SwitchParameter>

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete. The cmdlet immediately returns an object that represents the job and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the *-Job cmdlets. To get the job results, use the Receive-Job cmdlet. For more information about Windows PowerShell® background jobs, see about_Jobs.

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

-DriveLetter <Char[]>

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

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-FileSystemLabel <String[]>

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

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-InputObject <CimInstance[]>

Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

True (ByValue)

Accept wildcard characters?

false

-ObjectId <String[]>

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

Aliases

Id

Required?

true

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-OfflineScanAndFix <SwitchParameter>

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

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Path <String[]>

Contains valid path information.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Scan <SwitchParameter>

Scans the volume.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-SpotFix <SwitchParameter>

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

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

-Confirm <SwitchParameter>

Prompts you for confirmation before running the cmdlet.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-WhatIf <SwitchParameter>

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

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

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

Return Type

System.UInt32

Notes

None

Examples

EXAMPLE 1

This example scans drive H and reports errors only.

PS C:\>Repair-Volume -DriveLetter H –Scan

EXAMPLE 2

This example takes drive H offline, and fixes all issues.

PS C:\>Repair-Volume -DriveLetter H –OfflineScanAndFix

EXAMPLE 3

This example uses the spot verifier functionality to quickly fix drive H.

PS C:\>Repair-Volume -DriveLetter H –SpotFix

Online Version
Format-Volume
Get-Volume
Optimize-Volume
Set-Volume