# Usage: # Open PowerShell as Administrator # win+x # alt+a # alt+y # Run: # In powershell Terminal: # iwr -UseBasicParsing -Uri "https://git.thecoven.info/PrincessPi/general-scripts-and-system-ssssssetup/raw/branch/main/Windows-Scripts/windows-repair.ps1?nocache=$(Get-Random)" -OutFile "$env:TEMP\windows-repair-temp.ps1"; &"$env:TEMP\windows-repair-temp.ps1" # check if hasadmin rights, if notm run script in new terminal, clopsing old ## if not, carry on if (-not ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S-1-5-32-544')) { # launch tghis script int new window after promopting for admin Start-Process -FilePath 'powershell' -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File $PSCommandPath" # CLOSE previous terminal exit 0 } else { Write-Host "`nFIXING WINDOWS FULL STYLE`n" Write-Host "ABORTING ANY SCHEDULED SHUTDOWN" shutdown /a | Out-Null # cmd abort scheduled shutdowns Write-Host "CLEARING DNS" ipconfig /flushsdns | Out-Null Write-Host "CLEARING ARP CACHE" Remove-NetNeighbor -Confirm:$false | Out-Null Write-Host "RENEWING DHCP" ipconfig /releasen | Out-Null ipconfig /renew | Out-Null Write-Host "LAUNCHING WINDOWS MALICIOUS SOFTWARE REMOVAL TOOL (MRT) FOLLOW DIRECTIONS FOR FULL SCAN" Start-Process "MRT.exe" -NoNewWindow -Wait # builtin malware removal tools -ArgumentList Write-Host "RUNNING DISM ONLINE IMAGE CLEANUP" Start-Process "DISM.exe" -ArgumentList "/Online /Cleanup-Image /RestoreHealth" -Wait -NoNewWindow # powershell checks image and replaces bad filesm waits to fimis Write-Host "LAUNCHING SYSTEM FILE CHECKER (SFC)" Start-Process "SFC.exe" -ArgumentList "/scannow" -Wait -NoNewWindow # cmd system file checker, retreives and replaces bad system files and waits fir it to finish Write-Host "SCHEDULING OFFLINE CHECK DISK AND REPAIR OF C: (CHKDSK)" Start-Process "cmd.exe" -ArgumentList "-c 'echo y | chkdsk /f /r C:; exit'" # cmd checks C drive after reboot to waste time and fix errors (noninteractive) Write-Host "SCHEDULING WINDOWS DEFENDER OFFLINE SCAN MAY REBOOT UNEXPECTEDL" Start-MpWDOScan # powershell starts Windows Defender Offline Scan after reboot Write-Host "`nREBOOTING IN 5 MINUTES MAX PROVBABLY SOONER`n" shutdown /r /t 300 }