PowerShell for Junior SOC Analysts
From Zero to Security Hero - A Beginner's Complete Guide
👋 Welcome to Your PowerShell Journey!
If you're new to SOC work or PowerShell, you're in the right place! This guide assumes you're starting from scratch. We'll build your skills step-by-step, focusing on practical security tasks you'll do every day as a SOC analyst.
What You'll Learn:
PowerShell basics explained in plain English
How to investigate security alerts
Finding suspicious activity on computers
Analysing logs to spot attackers
Automating repetitive security tasks
Building your first security scripts
No prior PowerShell experience needed! We'll start with the absolute basics and build from there.
🎓 PowerShell Basics - Plain English Explanations
What is PowerShell?
Think of PowerShell as a way to talk directly to Windows computers. Instead of clicking through menus, you type commands. This is much faster for security work!
Why PowerShell for SOC Analysts?
Investigate 100 computers as easily as investigating 1
Find suspicious activity in seconds instead of hours
Automate boring, repetitive tasks
See information GUIs don't show you
Understanding Commands (Cmdlets)
PowerShell commands are called "cmdlets" (pronounced "command-lets"). They follow a Verb-Noun pattern:
Common Verbs:
Get= Retrieve informationSet= Change somethingStart= Begin somethingStop= End somethingRemove= Delete somethingNew= Create something
Your First Commands
Pro Tip: Use Tab to auto-complete! Type Get-Proc then hit Tab, and PowerShell fills in the rest!
📖 Beginner's Security Cheatsheet
Starting PowerShell
Getting Help (Your #1 Tool!)
Basic Process Investigation
What Am I Looking For?
Processes without a Company name (might be suspicious)
Processes running from weird locations (like C:\Temp)
Unfamiliar process names
Processes using lots of CPU or memory
Service Investigation
Security Note: Attackers often install malicious services. Look for:
Services with unusual names
Services not from known vendors
Services running from user folders
Network Connection Checks
What to Look For:
Connections to suspicious IP addresses
Unusual ports (not 80, 443, which are normal web traffic)
Programs you don't recognize making connections
User Account Investigation
Security Red Flags:
User accounts you don't recognise
Accounts that shouldn't be administrators
Recently created accounts
Disabled accounts that are now enabled
Event Log Basics - Finding Failed Logins
Important Event IDs to Remember:
4624 = Successful login
4625 = Failed login (potential brute force!)
4688 = New process started
4672 = Special privileges assigned (admin login)
4720 = User account created
Event Log Basics - Process Creation
PowerShell Activity Logs
Why This Matters: Attackers love using PowerShell! Look for:
Invoke-ExpressionorIEX(running downloaded code)DownloadString(downloading from the internet)Long, encoded commands (trying to hide what they're doing)
File Investigation
Security Uses:
Find recently downloaded executables
Identify files by their hash
Locate files in suspicious locations
Checking Startup Programs (Persistence)
Why Check These? Malware often sets itself to run automatically when Windows starts. These are the most common places it hides.
🔍 Common Investigation Scenarios
Scenario 1: "Check if someone tried to hack into this account"
What You're Looking For:
Many failed attempts = possible brute force attack
Failed logins at odd hours (2 AM, etc.)
Logins from unusual locations
Scenario 2: "This computer is acting weird, is there malware?"
Scenario 3: "Someone ran a suspicious command - find out what happened"
Scenario 4: "Find all activity from this user in the last week"
💡 Understanding PowerShell Concepts
Variables (Storing Information)
Variables let you save information to use later. They start with $:
The Pipeline (Chaining Commands)
The pipeline | sends output from one command to another:
Filtering with Where-Object
Where-Object is like a filter - it only lets matching items through:
Selecting Specific Properties
Select-Object picks which columns to show:
Formatting Output
🎯 Your First Security Scripts
Script 1: Quick System Security Check
Save this as Quick-SecurityCheck.ps1:
How to Run:
Save the code above as
Quick-SecurityCheck.ps1Open PowerShell as Administrator
Navigate to where you saved it:
cd C:\ScriptsRun it:
.\Quick-SecurityCheck.ps1
Script 2: Failed Login Monitor
Script 3: Process Investigator
📚 Learning Resources for Beginners
Free Online Resources
Official Microsoft Documentation:
PowerShell 101 for Beginners: https://docs.microsoft.com/powershell/scripting/learn/ps101/00-introduction
PowerShell Learn Modules: https://docs.microsoft.com/learn/browse/?terms=PowerShell
YouTube Channels:
John Hammond (Security + PowerShell)
ITPro.TV PowerShell courses
Shane Young's PowerShell basics
Practice Platforms:
OverTheWire Bandit (Linux/command line fundamentals)
UnderTheWire (PowerShell-specific challenges)
TryHackMe (security-focused practice)
Books for Beginners
"Learn PowerShell in a Month of Lunches" by Travis Plunk
"PowerShell for Sysadmins" by Adam Bertram
"Windows PowerShell Cookbook" by Lee Holmes
Communities & Help
Reddit: r/PowerShell (very beginner-friendly!)
PowerShell.org Forums
Discord: PowerShell Server
Stack Overflow (tag: powershell)
🎓 Practice Exercises
Week 1 Exercises
Exercise 1: Command Discovery
Find all commands that work with services
Find all commands that work with processes
Find commands that can "stop" things
Exercise 2: Process Investigation
List all running processes
Find all Chrome processes
Find the process using the most memory
Export all processes to a CSV file
Exercise 3: Service Management
List all services
Find all stopped services
Find services that start automatically
Count how many services are running
Week 2 Exercises
Exercise 4: Network Connections
Show all established connections
Find what's listening on your computer
Identify which process owns port 443
Count total active connections
Exercise 5: User Investigation
List all local users
Find administrators
Show enabled vs disabled accounts
Find when each user last logged in
Exercise 6: Pipeline Practice
Get processes, filter for Microsoft, sort by memory
Get services, filter for running, export to CSV
Get processes, filter by name, show only 3 properties
Week 3-4 Exercises
Exercise 7: Event Log Basics
Get last 100 Security log events
Find Event ID 4624 (successful logins)
Count Event ID 4625 (failed logins) in last hour
Show failed logins in a readable format
Exercise 8: Time-Based Filtering
Find events from the last hour
Find events from yesterday
Find events between two specific times
Count events per hour
Exercise 9: PowerShell Activity
Find all PowerShell execution logs
Search for specific command keywords
Show who ran PowerShell commands
Find PowerShell run in last 24 hours
Week 5-6 Exercises
Exercise 10: File Investigation
List all files in Downloads folder
Find all .exe files
Find files created today
Calculate hash of a file
Exercise 11: Startup Investigation
Check both Run registry keys
Check Startup folders
List scheduled tasks
Identify non-Microsoft startup items
Exercise 12: Building Your First Script
Create a script that checks for suspicious processes
Add comments explaining what each line does
Save and run your script
Show results to a mentor/peer
⚠️ Common Beginner Mistakes (And How to Avoid Them)
Mistake 1: Not Using Get-Help
Wrong Approach: Guessing command parameters
Right Approach: Always check help first
Mistake 2: Forgetting -ErrorAction
Problem: Scripts stop when they hit errors
Solution: Use error handling
Mistake 3: Not Filtering at the Source
Slow Way:
Fast Way:
Mistake 4: Forgetting to Run as Administrator
Some commands need admin rights. If a command fails, try running PowerShell as Administrator.
Mistake 5: Not Exporting Results
Always save your findings!
🎯 30-Day Challenge for Beginners
Week 1: Foundations
Day 1-7: Run one new command every day and document what it does
Goal: Learn 7 essential cmdlets by heart
Week 2: Investigation Basics
Day 8-14: Investigate your own computer daily
Goal: Find and document all startup programs, services, and scheduled tasks
Week 3: Event Logs
Day 15-21: Check event logs daily for specific Event IDs
Goal: Understand the top 10 security Event IDs
Week 4: Scripting
Day 22-28: Write one small script per day
Goal: Build a personal toolkit of 7 useful scripts
Week 5: Real Practice
Day 29-30: Combine everything into a comprehensive security check
Goal: Create your first professional investigation script
🏆 Success Milestones
Milestone 1: First Week ✓
[ ] Can open PowerShell and run basic commands
[ ] Understand Get-Help and Get-Command
[ ] Can list processes and services
[ ] Understand the pipeline concept
Milestone 2: First Month ✓
[ ] Can investigate processes, services, and network connections
[ ] Understand basic event log queries
[ ] Can filter and format output
[ ] Have written first simple script
Milestone 3: Two Months ✓
[ ] Comfortable with event log investigations
[ ] Can check for persistence mechanisms
[ ] Understand file hashing
[ ] Have a personal script library
[ ] Can conduct basic security investigations
Milestone 4: Ready for More ✓
[ ] Can investigate security alerts independently
[ ] Comfortable scripting common tasks
[ ] Understand what to look for in investigations
[ ] Ready to learn intermediate PowerShell
🚀 Next Steps After This Guide
Once you complete this beginner guide, you're ready for:
Intermediate PowerShell Skills:
Advanced filtering and searching
Remote computer investigation
Custom functions and modules
Error handling and logging
Security-Specific Topics:
MITRE ATT&CK framework
Threat hunting techniques
Malware analysis basics
Incident response procedures
Automation & Efficiency:
Writing production scripts
Scheduled automation
Integration with SIEM tools
Building detection rules
Certifications to Consider:
CompTIA Security+
Microsoft Security Operations Analyst (SC-200)
GIAC Security Essentials (GSEC)
💡 Quick Reference Card
Most Important Commands for SOC Work
Key Event IDs to Memorise
4624
Successful login
Security
4625
Failed login
Security
4688
Process created
Security
4672
Admin privileges assigned
Security
4720
User account created
Security
4728
User added to security group
Security
4104
PowerShell script block
PowerShell/Operational
7045
Service installed
System
🆘 Getting Help When Stuck
When you don't understand a command:
When you get an error:
Read the error message carefully (it usually tells you what's wrong!)
Check if you need to run as Administrator
Search the error message on Google
Ask in PowerShell communities
Where to Ask Questions:
Reddit: r/PowerShell (very helpful community!)
PowerShell.org forums
Stack Overflow (tag: PowerShell)
Your SOC team members (they were beginners once too!)
Pro Tip: When asking for help, include:
What you're trying to do
The command you ran
The error message you got
What you've already tried
🎉 Final Words of Encouragement
Remember:
Everyone starts as a beginner
PowerShell becomes easier with practice
Making mistakes is how you learn
The SOC community is helpful and supportive
Every expert was once where you are now
Your Learning Mindset:
Practice a little bit every day (15-30 minutes)
Don't rush - understanding beats memorisation
Keep notes of commands that work for you
Build your own cheat sheet as you learn
Celebrate small wins!
You've Got This! 🚀
Start with Day 1, take it slow, and before you know it, you'll be confidently investigating security incidents with PowerShell. Welcome to the SOC analyst community!
This guide is designed to grow with you. Bookmark it, refer back to it, and create your own notes as you learn!
Last updated