Skip to content

How to Use PowerShell to Automate Common Windows Tasks

Issue Description 

Repeating the same administrative tasks manually wastes time and increases the risk of errors. 

Common Causes 

  • Manual system management 
  • Lack of automation knowledge 
  • Repetitive admin tasks 

Step-by-Step Solution 

Step 1: Open PowerShell as Administrator 

  • Click Start 
  • Search PowerShell 
  • Right-click Windows PowerShell → Run as administrator 

 

Step 2: Allow Script Execution (One-Time Setup) 

  • In PowerShell, type: 
  • Set-ExecutionPolicy RemoteSigned 
  • Press Y and Enter 

 

Step 3: Run Common Commands 

Examples: 

  • List running processes: 
  • Get-Process 
  • Stop a process: 
  • Stop-Process -Name notepad 
  • List services: 
  • Get-Service 

 

Step 4: Create a Script 

  • Open Notepad 
  • Add commands 
  • Save as cleanup.ps1 
  • Right-click → Run with PowerShell 

 

Step 5: Schedule Automation 

  • Open Task Scheduler 
  • Create a basic task 
  • Point it to your .ps1 script 

Explore Further 

  • Use PowerShell ISE or VS Code 
  • Learn PowerShell modules 

Prevention & Best Practices 

Test scripts carefully before automating system changes.