Handy Script To Help Detect Unwanted Programs

Hello,

I have always wanted a software program that does the below function. I couldn’t find anything so I went ahead and made a script that does it.

I wanted to share with people in case it might be useful for others too.

Handy PowerShell Script

Write-Host "================ Eric's Handy 'Check-Run' POWERSHELL Script v1.0 ================"
Write-Host	"This powershell script records the services/drivers/tasks that are running."
Write-Host	" "
Write-Host	"After the inital snapshot, the script can compare and see what has changed."
Write-Host	" "
Write-Host	"NOTE: Six files are used by this script, located in C:\ for convenience. "
Write-Host  "1. services.txt,  2. drivers.txt,  3.tasks.txt"
Write-Host	"4. services2.txt, 5. drivers2.txt, 6. tasks2.txt"
Write-Host	" "
Write-Host	"The best way to use this script is to take a snapshot on a freshly installed"
Write-Host  "Windows OS with all of the basic software/drivers pre-installed."
Write-Host	" "
Write-Host	"This script is very good in helping detect junkware and viruses "
Write-Host  "that install themselves without permission or notification."
Write-Host	" "
Write-Host	"         PLEASE CHOOSE ONE OF THE FOLLOWING OPTIONS:"
Write-Host	"              ------------------------------"
Write-Host "1: Press '1' to take a SNAPSHOT of all running software  (This option will overwrite the previous snapshot)"
Write-Host "2: Press '2' to check the new changes to the SERVICES ***DO NOT CHOOSE BEFORE FIRST USING OPTION 1"
Write-Host "3: Press '3' to check the new changes to the DRIVERS  ***DO NOT CHOOSE BEFORE FIRST USING OPTION 1"
Write-Host "4: Press '4' to check the new changes to the TASKS    ***DO NOT CHOOSE BEFORE FIRST USING OPTION 1"
Write-Host "5: Press 'q' to quit."

}

eric,
Welcome to the forum. :wave:t4:

Thanks for sharing. :+1:t4:

Without digging too deep into your code I’d like to recommend some improvemnts right away.

Instead of the excessive use of Write-Host you should consider adding a comment based help. This way your script would work like a normal PowerShell cmdlet. User unaware of the usage could call the help and users already familiar with your script wouldn’t be bothered every time they use your script.

Here you can read more about:

I’d recommend to read as well the

Regardless of that - if you insist to output excessive text chapters to the console you’d use here-strings instead of several individual code lines with Write-Host. … something like this:

@'
================ Eric's Handy 'Check-Run' POWERSHELL Script v1.0 ================
   This powershell script records the services/drivers/tasks that are running.

   After the inital snapshot, the script can compare and see what has changed.

   NOTE: Six files are used by this script, located in C:\ for convenience. 
   1. services.txt,  2. drivers.txt,  3.tasks.txt
   4. services2.txt, 5. drivers2.txt, 6. tasks2.txt

   The best way to use this script is to take a snapshot on a freshly installed
   Windows OS with all of the basic software/drivers pre-installed.

   This script is very good in helping detect junkware and viruses 
   that install themselves without permission or notification.

             PLEASE CHOOSE ONE OF THE FOLLOWING OPTIONS:
                  ------------------------------
   1: Press '1' to take a SNAPSHOT of all running software  (This option will overwrite the previous snapshot)
   2: Press '2' to check the new changes to the SERVICES ***DO NOT CHOOSE BEFORE FIRST USING OPTION 1
   3: Press '3' to check the new changes to the DRIVERS  ***DO NOT CHOOSE BEFORE FIRST USING OPTION 1
   4: Press '4' to check the new changes to the TASKS    ***DO NOT CHOOSE BEFORE FIRST USING OPTION 1
   5: Press 'q' to quit.
'@