Automated Windows repair tool — runs DISM & SFC in sequence with admin elevation, portable shortcut generation, and custom icon support.
Download sfcfix.ps1After downloading, open your Downloads folder, right-click sfcfix.ps1, and select Run with PowerShell.
sfcfix.ps1 is a single-file PowerShell utility designed to streamline the two most important built-in Windows repair commands: DISM RestoreHealth and SFC /scannow. Running them manually requires opening an elevated prompt, remembering the exact syntax, and waiting for each to finish before starting the next. This script handles all of that automatically.
On first run it also downloads a custom shield icon from the host server and creates a persistent desktop shortcut, so any machine it touches is instantly set up for future use — no re-download needed.
Detects whether it is running with Administrator privileges. If not, it immediately re-launches itself via RunAs and exits the unprivileged window — no UAC prompt hunting required.
Checks the script's own directory for shield.ico. If absent, it fetches it from jharrsch.duckdns.org/dism-sfc/ and marks it as a hidden file to keep the folder tidy.
Creates a System Repair.lnk shortcut on the current user's Desktop, pointing back to this script with the correct execution policy flags and the custom icon already attached. Created once only.
Runs dism.exe /online /cleanup-image /restorehealth to repair the Windows component store using Windows Update as its source. Must complete before SFC for best results.
Runs sfc.exe /scannow to scan all protected system files and replace corrupt or missing ones with verified copies from the now-repaired component store.
After both operations complete the window pauses with a confirmation message and waits for the user to press Enter — preventing the console from closing before results can be read.
Click the Download sfcfix.ps1 button above. Your browser will save the file directly — it will not open in a tab.
Press Win + E to open File Explorer, then click Downloads in the left panel — or press Ctrl + J in your browser and click Show in folder.
Locate sfcfix.ps1, right-click it, and select Run with PowerShell. A UAC prompt will appear — click Yes to grant Administrator access. The script takes over from there.
After the first run, a System Repair shortcut is automatically placed on your Desktop. Use it anytime — no need to return to the Downloads folder.
Windows has blocked the script because it was downloaded from the internet. This is a security zone flag ("Mark of the Web") applied automatically to files saved from a browser. You must unblock the file before it will run.
Open PowerShell normally (no admin needed) and paste the command below as-is. It automatically detects your Downloads folder's real location — even if you have moved it to another drive.
Unblock-File -Path "$((New-Object -ComObject Shell.Application).Namespace('shell:Downloads').Self.Path)\sfcfix.ps1"
Right-click sfcfix.ps1 in File Explorer and select Properties. At the bottom of the General tab, check the box next to Unblock, then click OK. Right-click and Run with PowerShell again.
powershell.exe -ExecutionPolicy Bypass -File ".\sfcfix.ps1"
# ============================================================================== # SYSTEM REPAIR TOOL (sfcfix.ps1) # ============================================================================== # 1. AUTOMATIC ADMIN ELEVATION CHECK $isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if (-not $isAdmin) { # Re-runs the script with full administrative credentials and kills the standard window Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs Exit } # 2. LOCAL ICON HANDLING & DOWNLOAD $ScriptDirectory = Split-Path -Path $PSCommandPath -Parent $IconPath = Join-Path -Path $ScriptDirectory -ChildPath "shield.ico" if (-not (Test-Path $IconPath)) { Write-Host "Downloading custom shortcut icon..." -ForegroundColor Yellow Invoke-WebRequest -Uri "http://jharrsch.duckdns.org/dism-sfc/shield.ico" -OutFile $IconPath Set-ItemProperty -Path $IconPath -Name Attributes -Value "Hidden" } # 3. PORTABLE DESKTOP SHORTCUT GENERATION $ShortcutPath = "$env:USERPROFILE\Desktop\System Repair.lnk" if (-not (Test-Path $ShortcutPath)) { Write-Host "Generating desktop shortcut utility..." -ForegroundColor Yellow $WshShell = New-Object -ComObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($ShortcutPath) $Shortcut.TargetPath = "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" $Shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" $Shortcut.IconLocation = $IconPath $Shortcut.Save() } # 4. CORE DIAGNOSTIC & REPAIR ENGINE Write-Host "`n==================================================" -ForegroundColor Cyan Write-Host " Running Windows Deployment Image Servicing (DISM)..." -ForegroundColor Cyan Write-Host "==================================================" -ForegroundColor Cyan dism.exe /online /cleanup-image /restorehealth Write-Host "`n==================================================" -ForegroundColor Cyan Write-Host " Running System File Checker (SFC)..." -ForegroundColor Cyan Write-Host "==================================================" -ForegroundColor Cyan sfc.exe /scannow # 5. EXECUTION PAUSE Write-Host "`nAll operations have concluded successfully." -ForegroundColor Green Read-Host -Prompt "Press Enter to exit the application"
| Item | Details | Status |
|---|---|---|
| Windows 10 / 11 | Required for DISM and SFC availability | Required |
| PowerShell 5.1+ | Included with all modern Windows installs | Required |
| Internet Access (first run) | Needed to fetch shield.ico from the host server |
First run only |
| Administrator Rights | Automatically requested via UAC prompt | Auto-elevated |
| shield.ico | Downloaded from jharrsch.duckdns.org/dism-sfc/ |
Auto-downloaded |
| File Unblocked | Required on PCs where the script was downloaded from the internet — see Troubleshooting | If needed |