rc.347
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
# alt+y
|
# alt+y
|
||||||
# Run:
|
# Run:
|
||||||
# In admin powershell Terminal:
|
# In admin powershell Terminal:
|
||||||
# iwr 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; powershell -NoProfile -ep Bypass -File $env:TEMP\windows-repair-temp.ps1
|
# iwr 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; powershell -nop -ep Bypass -File $env:TEMP\windows-repair-temp.ps1
|
||||||
|
|
||||||
# check if hasadmin rights, if notm run script in new terminal, clopsing old
|
# check if hasadmin rights, if notm run script in new terminal, clopsing old
|
||||||
## if not, carry on
|
## if not, carry on
|
||||||
@@ -13,7 +13,7 @@ if (-not ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S
|
|||||||
# launch tghis script int new window after promopting for admin
|
# launch tghis script int new window after promopting for admin
|
||||||
Start-Process -FilePath 'powershell' -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File $PSCommandPath"
|
Start-Process -FilePath 'powershell' -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File $PSCommandPath"
|
||||||
|
|
||||||
# CLOSE previous terminal
|
# CLOSE previous terminal with success
|
||||||
exit 0
|
exit 0
|
||||||
} else {
|
} else {
|
||||||
Clear-Host # clear window
|
Clear-Host # clear window
|
||||||
@@ -82,67 +82,67 @@ if (-not ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S
|
|||||||
Write-Output "Creating Log Dir at $LogDir 1/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))"
|
Write-Output "Creating Log Dir at $LogDir 1/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))"
|
||||||
mkdir "$LogDir" > $null 2> $null # create log dir
|
mkdir "$LogDir" > $null 2> $null # create log dir
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm')) Initialize Log File $LogFile 3/21`nFollow Log File in Another Terminal With`n`t``Get-Content `"$MainLog`" -Wait -Tail 50``"
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm')) Initialize Log File $LogFile 3/21`n`tFollow Log File in Another Terminal With`n`t`t``Get-Content `"$MainLog`" -Wait -Tail 50``"
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))" >> "$MainLog"
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))" >> "$MainLog"
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tOpening Log Dir 2/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tOpening Log Dir 2/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
explorer.exe "$LogDir"
|
explorer.exe "$LogDir"
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tAborting Any Scheduled Shutdowns 4/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tAborting Any Scheduled Shutdowns 4/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
shutdown.exe /a > $null 2>> "$MainLog" # cmd abort scheduled shutdowns
|
shutdown.exe /a > $null 2>> "$MainLog" # cmd abort scheduled shutdowns
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tCreating Log Dir at $LogDir 5/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tCreating Log Dir at $LogDir 5/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
New-Item -Path "$LogDir" -ItemType Directory > $null 2>> "$MainLog" # create log dir
|
New-Item -Path "$LogDir" -ItemType Directory > $null 2>> "$MainLog" # create log dir
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tGenerating and Displaying Comprehensive Stability Report 6/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tGenerating and Displaying Comprehensive Stability Report 6/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Start-Process "perfmon.exe" -ArgumentList "/report" -Wait # running report
|
Start-Process "perfmon.exe" -ArgumentList "/report" -Wait # running report
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tGenerating and Displaying Stability History Report 7/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tGenerating and Displaying Stability History Report 7/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Start-Process "perfmon.exe" -ArgumentList "/rel" -Wait # historical report
|
Start-Process "perfmon.exe" -ArgumentList "/rel" -Wait # historical report
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tClearning DNS Cache 8/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tClearning DNS Cache 8/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
ipconfig.exe /flushsdns > $null 2>> "$MainLog" # flush dns cache
|
ipconfig.exe /flushsdns > $null 2>> "$MainLog" # flush dns cache
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tClearing ARP Table 9/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tClearing ARP Table 9/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Remove-NetNeighbor -Confirm:$false > $null 2>> "$MainLog" # flush ARP Table
|
Remove-NetNeighbor -Confirm:$false > $null 2>> "$MainLog" # flush ARP Table
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tClearing ALL Samba Credentials 10/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tClearing ALL Samba Credentials 10/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
net.exe use * /delete /y > $null 2>> "$MainLog" # nuke all samba creds automagically
|
net.exe use * /delete /y > $null 2>> "$MainLog" # nuke all samba creds automagically
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tReleasing and Renweing DHCP 11/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tReleasing and Renweing DHCP 11/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
# release and renew dhcp
|
# release and renew dhcp
|
||||||
ipconfig.exe /release > $null 2>> "$MainLog"
|
ipconfig.exe /release > $null 2>> "$MainLog"
|
||||||
ipconfig.exe /renew > $null 2>> "$MainLog"
|
ipconfig.exe /renew > $null 2>> "$MainLog"
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tGetting Control of Windows Update 12/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tGetting Control of Windows Update 12/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Install-Module -Name PSWindowsUpdate -Force > $null 2>> "$MainLog"
|
Install-Module -Name PSWindowsUpdate -Force > $null 2>> "$MainLog"
|
||||||
Import-Module PSWindowsUpdate
|
Import-Module PSWindowsUpdate
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tUpdating Windows 13/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tUpdating Windows 13/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Get-WindowsUpdate -AcceptAll -Install -IgnoreReboot > $null 2>> "$MainLog"
|
Get-WindowsUpdate -AcceptAll -Install -IgnoreReboot > $null 2>> "$MainLog"
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tUpdating Malware Signatures 14/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tUpdating Malware Signatures 14/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Update-MpSignature 2>> "$MainLog" # update windows defender malware siggs
|
Update-MpSignature 2>> "$MainLog" # update windows defender malware siggs
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tRunning FULL Windows Defender SCAN 15/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tRunning FULL Windows Defender SCAN 15/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Start-MpScan -ScanType FullScan 2>> "$MainLog" # full windows defender scan
|
Start-MpScan -ScanType FullScan 2>> "$MainLog" # full windows defender scan
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tRunning DISM Online Image Cleanup 16/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tRunning DISM Online Image Cleanup 16/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
DISM.exe /Online /Cleanup-Image /RestoreHealth 2>> "$MainLog" # online check for bad files
|
DISM.exe /Online /Cleanup-Image /RestoreHealth 2>> "$MainLog" # online check for bad files
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tRunning System File Checker 17/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tRunning System File Checker 17/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
SFC.exe /scannow 2>> "$MainLog" # older check for bad files
|
SFC.exe /scannow 2>> "$MainLog" # older check for bad files
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tScheduling Essential File Check on Next Boot 18/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tScheduling Essential File Check on Next Boot 18/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
SFC.exe /scanonce 2>> "$MainLog" # check essential files on next boot
|
SFC.exe /scanonce 2>> "$MainLog" # check essential files on next boot
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tScheduling Offline chkdsk and Repair of C: 19/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tScheduling Offline chkdsk and Repair of C: 19/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Write-Output 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-Output 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-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tScheduling Offline Memory Test at Next Boot 20/21" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tScheduling Offline Memory Test at Next Boot 20/21" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
mdsched.exe /s 2>> "$MainLog" # schedule offline memtest (noninteractive)
|
mdsched.exe /s 2>> "$MainLog" # schedule offline memtest (noninteractive)
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tScheduling Windows Defender Offline Scan 21/21`n`tMAY REBOOT UNEXPECTEDLY`n" | Tee-Object -FilePath "$MainLog" -Append
|
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`tScheduling Windows Defender Offline Scan 21/21`n`tMAY REBOOT UNEXPECTEDLY`n" | Tee-Object -FilePath "$MainLog" -Append
|
||||||
Start-MpWDOScan 2>> "$MainLog" # powershell starts Windows Defender Offline Scan after reboot
|
Start-MpWDOScan 2>> "$MainLog" # powershell starts Windows Defender Offline Scan after reboot
|
||||||
|
|
||||||
Write-Host "`nRebooting in 5 Minutes MAX Probably Sooner`n" -ForegroundColor Magenta
|
Write-Host "`nRebooting in 5 Minutes MAX Probably Sooner`n" -ForegroundColor Magenta
|
||||||
|
|||||||
Reference in New Issue
Block a user