Skip to content

Instantly share code, notes, and snippets.

@dpo007
Last active January 14, 2020 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpo007/38f7d9e6d211b5df980dc6f4358853b1 to your computer and use it in GitHub Desktop.
Save dpo007/38f7d9e6d211b5df980dc6f4358853b1 to your computer and use it in GitHub Desktop.
PowerShell script :: Scan all drives with letters on given disk.
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