Check Disk in PowerShell
By: Cam Wohlfeil
Published: 2018-02-06 0000 EST
Category: Solutions
Tags:
powershell,
cmd
I use check disk as one of my basic troubleshooting tools. Here's the new PowerShell commands that serve the same purpose with the advantage of all PowerShell features. My favorite part of this command is that it's much faster than the original.
# chkdsk /f
Repair-Volume -DriveLetter H -Scan
# chkdsk /scan
Repair-Volume -DriveLetter H -OfflineScanAndFix
# chkdsk /spotfix
Repair-Volume -DriveLetter H -SpotFix
Bonus: Run on all local drives as a background job.
$drives = Get-PSDrive -PSProvider FileSystem
foreach ($drive in $drives) {Start-Job -ScriptBlock {Repair-Volume $drive -SpotFix}}
# See link below for more on background jobs
More Info: