This commit is contained in:
2026-06-13 03:03:38 -06:00
parent 592937843c
commit 7d31e44970
+42 -42
View File
@@ -75,78 +75,78 @@ if (-not ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S
'@
# vars
$LogDir = "$env:USERPROFILE\Downloads\Repair-Log-$((Get-Date).ToString('yyyy-MM-dd-HHmm'))" # path to new log Dir
$ErrorLog = "$LogDir\error.log" # error log file
$MainLog = "$LogDir\main.log" # error log file
Write-Host "FIXING WINDOWS FULL PRINCESS PI STYLE (THIS WILL TAKE MANY HOURS AND REBOOT MORE THAN ONCE, SLOWLY)`n" -ForegroundColor Magenta
Write-Host "Creating Log Dir at $LogDir 1/21"
New-Item -Path "$LogDir" -ItemType Directory > $null 2>> $null # create log dir
Write-Host "Creating Log Dir at $LogDir 1/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
New-Item -Path "$LogDir" -ItemType Directory > $null 2>> "$MainLog" # create log dir
Write-Host "OPENING LOG DIR $LogDir 2/21"
Write-Host "Opening Log Dir 2/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
explorer.exe "$LogDir"
Write-Host "Initialize Log File $LogFile 3/21"
Write-Host "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))" 2>> "$ErrorLog"
Write-Host "Initialize Log File $LogFile 3/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Write-Host "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))" >> "$MainLog"
Write-Host "ABORTING ANY SCHEDULED SHUTDOWN 4/21"
shutdown.exe /a > $null 2>> "$ErrorLog" # cmd abort scheduled shutdowns
Write-Host "ABORTING ANY SCHEDULED SHUTDOWN 4/21 AT $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
shutdown.exe /a > $null 2>> "$MainLog" # cmd abort scheduled shutdowns
Write-Host "Creating Log Dir at $LogDir 5/21"
New-Item -Path "$LogDir" -ItemType Directory > $null 2>> "$ErrorLog" # create log dir
Write-Host "Creating Log Dir at $LogDir 5/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
New-Item -Path "$LogDir" -ItemType Directory > $null 2>> "$MainLog" # create log dir
Write-Host "GENERATING AND DISPLAYING COMPREHENSIVE STABILITY REPORT 6/21"
Write-Host "Generating and Displaying Comprehensive Stability Report 6/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Start-Process "perfmon.exe" -ArgumentList "/report" -Wait # running report
Write-Host "GENERATING AND DISPLAYING STABILITY HISTORY REPORT 7/21"
Write-Host "Generating and Displaying Stability History Report 7/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Start-Process "perfmon.exe" -ArgumentList "/rel" -Wait # historical report
Write-Host "CLEARING DNS 8/21"
ipconfig.exe /flushsdns > $null 2>> "$ErrorLog" # flush dns cache
Write-Host "Clearning DNS Cache 8/21 $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
ipconfig.exe /flushsdns > $null 2>> "$MainLog" # flush dns cache
Write-Host "CLEARING ARP CACHE 9/21"
Remove-NetNeighbor -Confirm:$false > $null 2>> "$ErrorLog" # flush ARP Table
Write-Host "Clearing ARP Table 9/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Remove-NetNeighbor -Confirm:$false > $null 2>> "$MainLog" # flush ARP Table
Write-Host "CLEARING ALL SAMBA CREDENTIALS 10/21"
net.exe use * /delete /y > $null 2>> "$ErrorLog" # nuke all samba creds automagically
Write-Host "Clearing ALL Samba Credentials 10/21 $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
net.exe use * /delete /y > $null 2>> "$MainLog" # nuke all samba creds automagically
Write-Host "RELEASING AND RENEWING DHCP 11/21"
Write-Host "Releasing and Renweing DHCP 11/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
# release and renew dhcp
ipconfig.exe /release > $null 2>> "$ErrorLog"
ipconfig.exe /renew > $null 2>> "$ErrorLog"
ipconfig.exe /release > $null 2>> "$MainLog"
ipconfig.exe /renew > $null 2>> "$MainLog"
Write-Host "GETTING CONTROL OF WINDOWS UPDATE 12/21"
Install-Module -Name PSWindowsUpdate -Force > $null 2>> "$ErrorLog"
Write-Host "Getting Control of Windows Update 12/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Install-Module -Name PSWindowsUpdate -Force 1> $null 2>> "$MainLog"
Import-Module PSWindowsUpdate
Write-Host "UPDATING WINDOWS 13/21"
Get-WindowsUpdate -AcceptAll -Install -IgnoreReboot > $null 2>> "$ErrorLog"
Write-Host "Updating Windows 13/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Get-WindowsUpdate -AcceptAll -Install -IgnoreReboot > $null 2>> "$MainLog"
Write-Host "UPDATING MALWARE SIGNATURES 14/21"
Update-MpSignature 2>> "$ErrorLog" # update windows defender malware siggs
Write-Host "Updating Malware Signatures 14/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Update-MpSignature 2>> "$MainLog" # update windows defender malware siggs
Write-Host "RUNNING FULL WINDOWS DEFENDER SCAN 15/21"
Start-MpScan -ScanType FullScan 2>> "$ErrorLog" # full windows defender scan
Write-Host "Running FULL Windows Defender SCAN 15/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Start-MpScan -ScanType FullScan 2>> "$MainLog" # full windows defender scan
Write-Host "RUNNING DISM ONLINE IMAGE CLEANUP 16/21"
DISM.exe /Online /Cleanup-Image /RestoreHealth 2>> "$ErrorLog" # online check for bad files
Write-Host "Running DISM Online Image Cleanup 16/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
DISM.exe /Online /Cleanup-Image /RestoreHealth 2>> "$MainLog" # online check for bad files
Write-Host "RUNNING SYSTEM FILE CHECKER (SFC) 17/21"
SFC.exe /scannow 2>> "$ErrorLog" # older check for bad files
Write-Host "Running System File Checker 17/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
SFC.exe /scannow 2>> "$MainLog" # older check for bad files
Write-Host "SCHEDULING ESSENTIAL FILE CHECK ON NEXT BOOT 18/21"
SFC.exe /scanonce 2>> "$ErrorLog" # check essential files on next boot
Write-Host "Scheduling Essential File Check on Next Boot 18/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
SFC.exe /scanonce 2>> "$MainLog" # check essential files on next boot
Write-Host "SCHEDULING OFFLINE CHECK DISK AND REPAIR OF C: (CHKDSK) 19/21"
echo y | chkdsk.exe /f /r C: > $null 2>> "$ErrorLog" # cmd checks C drive after reboot to waste time and fix errors (noninteractive via y ffuckery)
Write-Host "Scheduling Offline chkdsk and repair of C: 19/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
echo y | chkdsk.exe /f /r C: > $null 2>> "$MainLog" # cmd checks C drive after reboot to waste time and fix errors (noninteractive via y ffuckery)
Write-Host "SCHEDULINMG OFFLINE MEMTEST 20/21"
mdsched.exe /s 2>> "$ErrorLog" # schedule offline memtest (noninteractive)
Write-Host "Scheduling OFFLINE MEMTEST 20/21" | Tee-Object -FilePath "$MainLog" -Append
mdsched.exe /s 2>> "$MainLog" # schedule offline memtest (noninteractive)
Write-Host "SCHEDULING WINDOWS DEFENDER OFFLINE SCAN MAY REBOOT UNEXPECTEDLY 21/21"
Start-MpWDOScan 2>> "$ErrorLog" # powershell starts Windows Defender Offline Scan after reboot
Write-Host "Scheduling Windows Defender Offline Scan MAY REBOOT UNEXPECTEDLY 21/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append
Start-MpWDOScan 2>> "$MainLog" # powershell starts Windows Defender Offline Scan after reboot
Write-Host "`nREBOOTING IN 5 MINUTES MAX PROVBABLY SOONER`n"
shutdown.exe /r /t (60*5) # shutdown in 5 minutes as failsafe
Write-Host "`nDONEsiez :3~`n"
Write-Host "`n$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`n`nDONEsiez :3~`n" | Tee-Object -FilePath "$MainLog" -Append
}