Added check-file-system.ps1

This commit is contained in:
Markus Fleschutz
2021-04-05 10:48:34 +02:00
parent cfbad6f2d7
commit d10466f01c
3 changed files with 32 additions and 5 deletions

25
Scripts/check-file-system.ps1 Executable file
View File

@ -0,0 +1,25 @@
#!/bin/powershell
<#
.SYNTAX ./check-file-system.ps1 [<drive>]
.DESCRIPTION checks the validity of the file system (needs admin rights)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
#Requires -RunAsAdministrator
param($Drive = "")
if ($Drive -eq "" ) {
$Drive = read-host "Enter drive (letter) to check"
}
try {
repair-volume -driveLetter $Drive -scan
write-host -foregroundColor green "OK - drive $Drive is non-corrupt"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}