mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-10 05:17:44 +02:00
Added check-file-system.ps1
This commit is contained in:
25
Scripts/check-file-system.ps1
Executable file
25
Scripts/check-file-system.ps1
Executable 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
|
||||
}
|
Reference in New Issue
Block a user