Skip to content

Check-WindowsSystemFiles

Checks the validity of the Windows system files (requires admin rights)

#Requires -RunAsAdministrator

try {
	sfc /verifyOnly
	if ($lastExitCode -ne 0) { throw "'sfc /verifyOnly' failed" }

	"? checked Windows system files"
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.