Skip to content

Instantly share code, notes, and snippets.

@jonimattila
Created January 8, 2020 07:36
Show Gist options
  • Save jonimattila/d34c1ec74ffb7dc99bd6326ae8929e05 to your computer and use it in GitHub Desktop.
Save jonimattila/d34c1ec74ffb7dc99bd6326ae8929e05 to your computer and use it in GitHub Desktop.
Start-Process -FilePath "${env:Windir}\System32\SFC.EXE" -ArgumentList '/scannow' -Wait -Verb RunAs
Repair-WindowsImage -Online -scanhealth
Repair-WindowsImage -Online -checkhealth
if ($ComputerProperties = Repair-WindowsImage -Online -checkhealth | Select-Object ImageHealthState | Where-Object {($_.ImageHealthState -notlike "Healthy")}) {
Repair-WindowsImage -Online -RestoreHealth}
Start-Process -FilePath "${env:Windir}\System32\SFC.EXE" -ArgumentList '/scannow' -Wait -Verb RunAs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment