From cdb3edceba186243c1dc193691ef0db2918df61f Mon Sep 17 00:00:00 2001 From: BigoStream <54169638+REALSDEALS@users.noreply.github.com> Date: Tue, 28 Mar 2023 13:31:43 +0200 Subject: [PATCH] Add: DiskCheck, DISM and SFC Add: Added functionality to the .PS script. DiskCheck, DISM and SFC have been intergrated. Function 5 and 6 in the pcHealth.ps script. --- Documentation/changelog.md | 7 ++++ Scripts/PowerShell/pcHealth.ps1 | 65 +++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 20 deletions(-) diff --git a/Documentation/changelog.md b/Documentation/changelog.md index 56fbb17..422d2b1 100644 --- a/Documentation/changelog.md +++ b/Documentation/changelog.md @@ -1,5 +1,12 @@ # Changelog.md - pcHealth +## 29-03-2023 - @REALSDEALS + +Added some new functionality to the PowerShell script. +It is now possible to use the 5th and 6th function. +--> The 5th function is almost the same as the 5th function from the pcHealth.bat script. +--> The 6th function will open the log after the 5th function has been ran. + ## 26-01-2023 - @BigoStream Centered the title from the menu that you are currently in. diff --git a/Scripts/PowerShell/pcHealth.ps1 b/Scripts/PowerShell/pcHealth.ps1 index 1a46f2e..4731b5f 100644 --- a/Scripts/PowerShell/pcHealth.ps1 +++ b/Scripts/PowerShell/pcHealth.ps1 @@ -33,16 +33,17 @@ function Show-Menu { Write-Host "3: ENTER '3' RUN A SYSTEM SCAN" Write-Host "4: ENTER '4' TO TRY AND REPAIR CORRUPT FILES" Write-Host "5: ENTER '5' TO RUN A SYSTEM SCAN AND START REPAIRING IN ONE GO" - Write-Host "6: ENTER '6' TO GENERATE A BATTERY REPORT" - Write-Host "7: ENTER '7' TO OPEN WINDOWS UPDATE(S)" - Write-Host "8: ENTER '8' TO START A SHORT PING TEST" - Write-Host "9: ENTER '9' TO START A CONTINUES PING TEST" - Write-Host "10: ENTER '10' TO RE-OPEN THE BATTERY REPORT" - Write-Host "11: ENTER '11' TO RE-OPEN THE CBS.log (DISM LOG)" - Write-Host "12: ENTER '12' TO GET YOUR NINITE (INCLUDES EDGE, CHROME, VLC AND 7ZIP)" - Write-Host "13: ENTER '13' TO RESTART OR SHUTDOWN YOUR LAPTOP/PC" - Write-Host "14: ENTER '14' TO SHUTDOWN YOUR LAPTOP/PC" - Write-Host "15: ENTER 'Q' TO CLOSE THIS POWERSHELL SCRIPT" + Write-Host "6: ENTER '6' TO OPEN THE GENERATED REPORT FROM FUNCTION 5" + Write-Host "7: ENTER '7' TO GENERATE A BATTERY REPORT" + Write-Host "8: ENTER '8' TO OPEN WINDOWS UPDATE(S)" + Write-Host "9: ENTER '9' TO START A SHORT PING TEST" + Write-Host "10: ENTER '10' TO START A CONTINUES PING TEST" + Write-Host "11: ENTER '11' TO RE-OPEN THE BATTERY REPORT" + Write-Host "12: ENTER '12' TO RE-OPEN THE CBS.log (DISM LOG)" + Write-Host "13: ENTER '13' TO GET YOUR NINITE (INCLUDES EDGE, CHROME, VLC AND 7ZIP)" + Write-Host "14: ENTER '14' TO RESTART OR SHUTDOWN YOUR LAPTOP/PC" + Write-Host "15: ENTER '15' TO SHUTDOWN YOUR LAPTOP/PC" + Write-Host "16: ENTER 'Q' TO CLOSE THIS POWERSHELL SCRIPT" Write-Host "" } do { @@ -73,46 +74,70 @@ do { 'Sorry, this option has no function yet.' pause } '5' { - 'Sorry, this option has no function yet.' - pause + Write-Host "" + Write-Host "This could take a hot minute, script will run in the background." + Write-Host "When 'Press ENTER to continue' displays, you can press 'ENTER' to return to the main menu of the script." + Write-Host "" + $ReturnTo = cd / + $GenDir = mkdir pcHealthLog + $Path = 'C:\pcHealthLog' + $Date = get-date -format "dd-MM-yyyy" + $LogFile = "C:\pcHealthLog\LogResults.txt" + start-job -name DiskCheck -ScriptBlock { CHKDSK C: } + start-job -name DISM -ScriptBlock { DISM /Online /Cleanup-Image /RestoreHealth } + start-job -name SFC -ScriptBlock { sfc /scannow } + if (test-path $path) { write-host "`$Path was found, exporting logs to $Path" } else { new-item C:\pcHealthLog -itemtype directory; Write-Host "$Path not found, creating $Path and exporting logs" } + wait-job -name DiskCheck, DISM, SFC | receive-job | out-file -FilePath $LogFile + Write-Host "" + Write-Host "Don't forget to run script function 6 to open the log." + Write-Host "" + Pause } '6' { + Write-Host "" + Write-Host "Attempting to open the log file..." + Write-Host "" + $ReturnTo = cd / + start "C:\pcHealthLog\LogResults.txt" + Write-Host "" + Pause + }'7' { Write-Host "" powercfg /batteryreport start "C:\battery-report.html" Write-Host "" pause - } '7' { + } '8' { Write-Host "" control update Write-Host "" pause - } '8' { + } '9' { Write-Host "" ping 8.8.8.8 Write-Host "" pause - } '9' { + } '10' { Write-Host "" ping 8.8.8.8 -t -l 256 Write-Host "" pause - } '10' { - 'Sorry, this option has no function yet.' - pause } '11' { 'Sorry, this option has no function yet.' pause } '12' { + 'Sorry, this option has no function yet.' + pause + } '13' { Write-Host "" start explorer.exe "https://ninite.com/7zip-chrome-edge-vlc/ninite.exe" pause - } '13' { + } '14' { Write-Host "" Write-Host "Your system will be restarted." Restart-Computer Write-Host "" pause - } '14' { + } '15' { Write-Host "" Write-Host "pc-Health.ps will be terminated." Write-Host ""