Last active
January 14, 2020 20:37
-
-
Save dpo007/38f7d9e6d211b5df980dc6f4358853b1 to your computer and use it in GitHub Desktop.
PowerShell script :: Scan all drives with letters on given disk.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[int]$DiskNumber = 0 | |
) | |
Write-Host "Gathering SMART info for Disk $DiskNumber..." | |
$disk = Get-Disk $DiskNumber | |
$disk | Get-StorageReliabilityCounter | Select * | FL | |
$partitionsWithDriveLetters = $disk | Get-Partition | Where-Object { [bool]$_.DriveLetter } | |
foreach ($partition in $partitionsWithDriveLetters) { | |
$driveLetter = $partition.DriveLetter | |
Write-Host "Scanning drive $driveLetter..." | |
Repair-Volume -Scan -DriveLetter $driveLetter | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment