Test-WssDrive

Checks a drive for file system errors, and optionally repairs errors.

Syntax

Test-WssDrive
    [-Drive] <Drive>
    [-Repair]
    [<CommonParameters>]
Test-WssDrive
    [-Drive] <Drive>
    [-Cancel]
    [<CommonParameters>]

Description

The Test-WssDrive cmdlet checks a drive for file system errors. You can use this cmdlet to attempt to repair file system errors. You can also use this cmdlet to stop a current check for errors. To obtain a Drive object to check, use the Get-WssDrive cmdlet.

Examples

Example 1: Check and repair a drive

PS C:\>$Drive = Get-WssDrive -ID b6b093a2-1860-4172-a4a5-07ce2aebfa13
PS C:\> Test-WssDrive -Drive $Drive -Repair

This example runs a check on a drive, and attempts to repair any file system errors. The first command uses the Get-WssDrive cmdlet to get a Drive object that has the specified GUID, and stores it in the $Drive variable.

The second command runs a check on the Drive object stored in the $Drive variable. The command includes the Repair parameter, therefore the command attempts to repair any file system errors it finds.

Parameters

-Cancel

Indicates that the cmdlet cancels an in-progress Test-WssDrive check.

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

-Drive

Specifies a Drive object. To obtain a Drive object, use the Get-WssDrive cmdlet.

Type:Drive
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Repair

Indicates that the cmdlet attempts to repair file system errors that it finds.

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

Inputs

Microsoft.WindowsServerSolutions.Storage.Drive

Outputs

Microsoft.WindowsServerSolutions.Storage.CheckDiskRequest

This cmdlet generates a request to check or repair a disk.