Test-WssDrive
Test-WssDrive
Checks a drive for file system errors, and optionally repairs errors.
Syntax
Parameter Set: OpParamSet
Test-WssDrive [-Drive] <Drive> [-Repair] [ <CommonParameters>]
Parameter Set: CancelParamSet
Test-WssDrive [-Drive] <Drive> [-Cancel] [ <CommonParameters>]
Detailed 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.
Parameters
-Cancel
Indicates that the cmdlet cancels an in-progress Test-WssDrive check.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Drive<Drive>
Specifies a Drive object. To obtain a Drive object, use the Get-WssDrive cmdlet.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-Repair
Indicates that the cmdlet attempts to repair file system errors that it finds.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- CheckDiskRequest, CancelOperationRequest
Examples
Example 1: Check and repair a drive
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.
PS C:\> $Drive = Get-WssDrive -ID b6b093a2-1860-4172-a4a5-07ce2aebfa13
PS C:\> Test-WssDrive -Drive $Drive -Repair