1 PowerShell for Cybersecurity
PowerShell matters for defenders as much as administrators — Event Log analysis, account investigations, process analysis, network connection analysis, file hashing, service inspection, certificate inspection, Active Directory investigations, incident-response collection, endpoint triage, API integration, SIEM automation, and IOC searches (Module 11 and Module 12 both draw on exactly this toolset).
Calculate a file hash with Get-FileHash ".\suspicious.exe" — typical algorithms are SHA256, SHA1, and MD5, with SHA256 commonly preferred for modern file identification (Module 12, Lesson 1's IOC discussion covers file hashes as evidence in more depth).
Check network connections with Get-NetTCPConnection (behaviour depends on Windows version), which can show local/remote address and port, connection state, and owning process ID. Correlate a suspicious remote connection back to the actual application:
Get-Process -Id 1234
Remote connection → process ID → application: the exact chain a SOC analyst walks when investigating unexpected outbound traffic (Module 11, Lesson 2).
2 Windows Event Log Investigation
PowerShell can query Windows Event Logs directly. The modern command is Get-WinEvent:
Get-WinEvent -LogName Security -MaxEvents 20
Get-WinEvent -FilterHashtable @{
LogName = "Security"
Id = 4625
}
Event ID 4625 typically represents a failed logon (Module 14, Lesson 3) — this is exactly how you'd investigate repeated authentication failures from the command line instead of clicking through Event Viewer by hand. Older scripts may use Get-EventLog instead; recognise it when maintaining legacy environments, but modern scripts generally favour Get-WinEvent because it supports newer Windows event-log infrastructure and considerably more flexible filtering.
3 Common Beginner Mistakes
$password = "Password123" (Lesson 5, Section 4).Get-ADUser -Filter * followed by processing hundreds of thousands of unnecessary objects, when a narrower directory query would have worked.429 Too Many Requests (Module 13, Lesson 2) — scripts may need retry logic, backoff, pagination, and throttling awareness.4 Interview Questions
$_?Import-Csv do?Invoke-RestMethod?Hands-On Labs
🔮 Lab – Service Health Checker
Write a script that checks Spooler, WinRM, and W32Time, printing each service's status, then modify it so any stopped service prints a WARNING.
Reveal a working approach
$Services = @("Spooler", "WinRM", "W32Time")
foreach ($ServiceName in $Services) {
$Service = Get-Service -Name $ServiceName
if ($Service.Status -ne "Running") {
Write-Host "WARNING: $ServiceName - $($Service.Status)"
}
else {
Write-Host "$ServiceName - $($Service.Status)"
}
}🔮 Lab – CSV User Processing
Given a CSV of usernames/departments/locations, import it, filter to just Finance users, and export the result to a new CSV.
Reveal a working approach
$Users = Import-Csv ".\users.csv"
$FinanceUsers = $Users | Where-Object Department -eq "Finance"
$FinanceUsers | Export-Csv ".\FinanceUsers.csv" -NoTypeInformation🔮 Lab – Event Log Investigation
Security reports multiple failed authentication attempts against a server. Retrieve Event ID 4625 from the Windows Security log and identify what you'd investigate next.
Reveal the approach
Get-WinEvent -FilterHashtable @{
LogName = "Security"
Id = 4625
}Then examine timestamp, username, source workstation, authentication type, and frequency — exactly the same investigative questions Module 14, Lesson 3 taught for a raw 4625 event, now automated instead of clicked through manually.
🔮 Lab – Bearer Token Authentication
Using a training token, build a header hash table and call an authenticated endpoint. Then deliberately test with no token, an invalid token, and an expired token. What HTTP responses do you expect for each?
Reveal the expected pattern
No token or an invalid/expired one should all return 401 Unauthorized (Module 13, Lesson 2); only a genuinely valid token should succeed. This ties together authentication, APIs, OAuth, JWT, and PowerShell all at once — exactly Lesson 3's point about this module connecting concepts from across the whole course.
🔮 Lab – Onboarding Simulator
Given a CSV of new hires, write a script that generates a display name, email address, and group for each row, and writes the intended action to a log — without creating any real AD users.
Reveal expected output
CREATE USER: asmith
EMAIL: alice.smith@example.com
DEPARTMENT: Finance
GROUP: GRP-Finance-Users
STATUS: READYThis is the safe simulate-before-execute pattern from Lesson 4's bulk IAM automation, applied to onboarding instead of offboarding.
Capstone – Enterprise Support Toolkit
Scenario: users report that an internal authentication application is unavailable. Build AuthenticationHealthCheck.ps1, checking DNS resolution, ping/connectivity, TCP 443, the Windows service, disk space, CPU, memory, recent application errors, an API health endpoint, and certificate expiry — producing output like:
===== AUTHENTICATION SYSTEM HEALTH =====
DNS PASS
HTTPS 443 PASS
Authentication Service PASS
Disk Space WARNING
API Health FAIL
Certificate PASS
Event Log Errors 14
Overall Status: DEGRADED
Export a matching AuthenticationHealthCheck.csv for escalation (Module 14, Lesson 6's escalation-with-evidence discipline applies directly here). This is very close to real automation engineers build in real organisations.
Broaden it into a full toolkit — EnterpriseSupportToolkit.ps1 containing at least five reusable functions (e.g. Test-Server, Test-Port, Get-DiskHealth, Get-ServiceHealth, Test-API, Get-RecentErrors, Get-SystemInformation), demonstrating variables, arrays, hash tables, conditions, loops, functions, pipeline processing, CSV import/export, JSON, REST APIs, error handling, and logging. Bonus: support multiple servers, produce CSV and JSON reports, use -Verbose, validate parameters, handle offline systems and HTTP failures gracefully, and contain zero hardcoded credentials.
Be ready to explain: what the script does, why you automated it, how errors are handled, how secrets are protected, how you tested it, how you'd deploy it safely, and how you'd roll back changes. A student who can build and explain this project has moved past memorising PowerShell syntax and started thinking like an IT engineer.
Module 15 Outcome
The most important lesson in this module was never "how do I write a loop?" It's how do I recognise a manual process that should become safe, repeatable automation? If an engineer spends 20 minutes every morning checking a server, a service, disk space, an API, a certificate, and logs, that's 20 minutes × 250 working days — and also a clear candidate for a HealthCheck.ps1 that produces the same report every time, consistently, without anyone having to remember all six steps.
But automation amplifies mistakes exactly as readily as it amplifies good work. A command executed manually might damage one object; an incorrectly written loop can damage ten thousand. Professional automation is therefore never just "PowerShell knowledge" — it's PowerShell knowledge combined with testing, least privilege, error handling, logging, change management, code review, and security, all at once. That combination is the actual difference between knowing PowerShell commands and being able to use PowerShell professionally.
Across all 6 lessons, you should now be able to explain that PowerShell is an enterprise automation platform, not just a command prompt; that objects and the pipeline are fundamental to how it works; that loops let operations scale from one system to thousands; that CSV and JSON are the two data formats enterprise automation runs on; that Invoke-RestMethod connects PowerShell directly to the API and authentication knowledge from Modules 9 and 13; that Windows PowerShell 5.1 and modern PowerShell 7 coexist in real enterprises for good reasons; that legacy technologies like WMI and AzureAD/MSOnline are still genuinely common; that PowerShell is a real cybersecurity and incident-response tool, not just an admin one; and that credentials, execution policy, testing, and least privilege all matter more than clever syntax. That's the real PowerShell skill: recognising repetitive IT work and turning it into safe, auditable, repeatable automation.