Process Management with Get-Process and Stop-Process
📖 Scenario: You are managing your computer's running programs. Sometimes, a program uses too much memory or is not responding. You want to find these programs and stop them safely.
🎯 Goal: You will write a PowerShell script that lists running processes, sets a memory usage limit, finds processes using more memory than this limit, and stops those processes.
📋 What You'll Learn
Create a variable with a list of running processes using
Get-ProcessCreate a variable called
memoryLimitMB with a value of 100Use a
foreach loop to find processes using more than memoryLimitMB megabytes of memoryStop those processes using
Stop-ProcessPrint the names of stopped processes
💡 Why This Matters
🌍 Real World
System administrators often need to manage processes that use too much memory or cause problems. This script helps automate that task.
💼 Career
Knowing how to list, filter, and stop processes is useful for IT support, system administration, and automation roles.
Progress0 / 4 steps