diff --git a/Windows-Scripts/windows-repair.ps1 b/Windows-Scripts/windows-repair.ps1 index 4d59c0b..48aa7b1 100644 --- a/Windows-Scripts/windows-repair.ps1 +++ b/Windows-Scripts/windows-repair.ps1 @@ -79,70 +79,70 @@ if (-not ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" + Write-Host "`tCreating Log Dir at $LogDir 1/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" mkdir "$LogDir" > $null 2> $null # create log dir - Write-Host "Initialize Log File $LogFile 3/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" + Write-Host "`tInitialize Log File $LogFile 3/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))`nFollow Log File in Another Terminal With Get-Content `"$LogFile`" -Wait -Tail 50" Write-Host "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))" >> "$LogDir\main.log" - Write-Host "Opening Log Dir 2/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tOpening Log Dir 2/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append explorer.exe "$LogDir" - Write-Host "ABORTING ANY SCHEDULED SHUTDOWN 4/21 AT $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tABORTING 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tCreating 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tGenerating 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tGenerating 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 "Clearning DNS Cache 8/21 $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tClearning 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 Table 9/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tClearing 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 $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tClearing 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 Renweing DHCP 11/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tReleasing 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>> "$MainLog" ipconfig.exe /renew > $null 2>> "$MainLog" - Write-Host "Getting Control of Windows Update 12/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tGetting 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tUpdating 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tUpdating 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tRunning 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tRunning 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 17/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tRunning 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tScheduling 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 chkdsk and repair of C: 19/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tScheduling 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 "Scheduling OFFLINE MEMTEST 20/21" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tScheduling Offline Memory Test at Next Boot 20/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | 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 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))" | Tee-Object -FilePath "$MainLog" -Append + Write-Host "`tScheduling Windows Defender Offline Scan 21/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))`n`tMAY REBOOT UNEXPECTEDLY" | 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"