Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Python How can i terminate a task in task manager using python?

Centsicles

New Coder
Well its a long story,i'll give you details in the comments for people who are intrested in helping me,before i start i do not have admin and im locked out of bios,my dad has a software called norton family,it has many features,and most i have bypassed,except for the deleting "suspicious" files one and more importantly,the time limit one,we're only going to focus on the time limit one,a few months back i found out if i terminate a specific task called NF.EXE,it would prevent the time limit from appearing for 5 seconds,then it would just boot back up again in a matter of seconds.The problem is that there are 2 NF.EXE in task manager and its a guessing game,but it doesnt take long to figure out which one will stop norton family from appearing for 5 seconds,i want a script that can terminate the correct NF.EXE preferrably in python,you can tell if you chosen the correct NF.EXE,because in task manager it won't say something along the lines of "you dont have administrator privileges" and it will also disappear for 5 seconds,if none of those things happen,you picked the wrong one.Thanks 🙂

I didn't really try anything,i asked reddit but that didnt seem to help.
 
Here’s an example Python script that attempts to terminate the NF.EXE processes and checks for the correct one:
Python:
import psutil
import time

def terminate_nf():
    # Get the list of processes
    processes = [proc for proc in psutil.process_iter(['pid', 'name']) if 'NF.EXE' in proc.info['name']]
    
    for proc in processes:
        try:
            proc.terminate()  # Attempt to terminate the process
            time.sleep(5)  # Wait for 5 seconds
            # Check if the process is still running
            if proc.is_running():
                print(f"Process {proc.info['name']} with PID {proc.info['pid']} is still running.")
            else:
                print(f"Terminated {proc.info['name']} with PID {proc.info['pid']}.")
        except (psutil.NoSuchProcess, psutil.AccessDenied):
            print(f"Failed to terminate {proc.info['name']} with PID {proc.info['pid']}. Access Denied.")

if __name__ == "__main__":
    terminate_nf()
 

New Threads

Buy us a coffee!

Back
Top Bottom