mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-06 06:38:31 +00:00
27 lines
982 B
Markdown
27 lines
982 B
Markdown
---
|
|
title: "System Corruption Scan"
|
|
description: ""
|
|
---
|
|
|
|
```powershell {filename="functions/public/Invoke-WPFSystemRepair.ps1",linenos=inline,linenostart=1}
|
|
function Invoke-WPFSystemRepair {
|
|
<#
|
|
.SYNOPSIS
|
|
Checks for system corruption using SFC, and DISM
|
|
Checks for disk failure using Chkdsk
|
|
|
|
.DESCRIPTION
|
|
1. Chkdsk - Checks for disk errors, which can cause system file corruption and notifies of early disk failure
|
|
2. SFC - scans protected system files for corruption and fixes them
|
|
3. DISM - Repair a corrupted Windows operating system image
|
|
#>
|
|
|
|
Start-Process cmd.exe -ArgumentList "/c chkdsk /scan /perf" -NoNewWindow -Wait
|
|
Start-Process cmd.exe -ArgumentList "/c sfc /scannow" -NoNewWindow -Wait
|
|
Start-Process cmd.exe -ArgumentList "/c dism /online /cleanup-image /restorehealth" -NoNewWindow -Wait
|
|
|
|
Write-Host "==> Finished System Repair"
|
|
Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
|
|
}
|
|
```
|