DEV Community

KAMAL KISHOR
KAMAL KISHOR

Posted on

⚡ PowerShell Hacks Part 2: Advanced Tricks Beyond the Basics

In Part 1 of this series, we explored 55+ PowerShell hacks that cover system administration, networking, automation, and even ethical hacking.

But if you’ve started using them, you probably noticed something: PowerShell can go even deeper.

In this Part 2 guide, I’ll share 20+ advanced hacks that go beyond the basics — touching on developer workflows, OS forensics, cloud/DevOps, and even some fun tricks to impress your colleagues.

Let’s dive in 🚀


🧑‍💻 Developer Productivity Hacks

56. Spin up a Local Web Server (Python Style)

Need to quickly test a folder as a website? No need for XAMPP or Nginx.

Start-Job {cd C:\MySite; python -m http.server 8080}
Enter fullscreen mode Exit fullscreen mode

⚡ Use Case: Serve static files, test frontends, or share a folder instantly.


57. Check API Response in Console

Invoke-RestMethod "https://jsonplaceholder.typicode.com/todos/1"
Enter fullscreen mode Exit fullscreen mode

🔍 Debug REST APIs directly from your terminal.


58. Pretty Print JSON

(Get-Content data.json | ConvertFrom-Json) | ConvertTo-Json -Depth 5
Enter fullscreen mode Exit fullscreen mode

📑 Makes raw JSON much easier to read.


59. Live Tail a Log File (Linux-style tail -f)

Get-Content C:\logs\app.log -Wait
Enter fullscreen mode Exit fullscreen mode

🔎 Essential when debugging web servers or applications.


60. Check Git Repo Status Across All Projects

Get-ChildItem -Recurse -Directory -Filter ".git" | ForEach-Object {
    Write-Output "Repo: $($_.FullName)"; git -C $_.Parent.FullName status
}
Enter fullscreen mode Exit fullscreen mode

🌀 Run git status across all repos in your dev folder.


🔍 OS & Forensics Hacks

61. List All Running Scheduled Tasks

Get-ScheduledTask | Where-Object {$_.State -eq "Running"}
Enter fullscreen mode Exit fullscreen mode

🕵 Great for investigating suspicious background jobs.


62. Check Event Logs for Failed Logins

Get-EventLog -LogName Security -InstanceId 4625 -Newest 10
Enter fullscreen mode Exit fullscreen mode

🔑 Find brute-force attempts or RDP login failures.


63. Find Recently Accessed Files

Get-ChildItem -Recurse C:\Users\* | Sort-Object LastAccessTime -Descending | Select -First 20
Enter fullscreen mode Exit fullscreen mode

🕵 Quickly identify suspicious file access.


64. List Processes with Network Connections (Like Netstat)

Get-NetTCPConnection | Select LocalAddress, LocalPort, RemoteAddress, RemotePort, State, OwningProcess
Enter fullscreen mode Exit fullscreen mode

🔎 Check which processes are talking to remote servers.


65. Check if Windows is Activated

slmgr /xpr
Enter fullscreen mode Exit fullscreen mode

💡 Useful on fresh installations or VM setups.


☁️ Cloud / DevOps Hacks

66. Test HTTP Status Code of a Website

(Invoke-WebRequest -Uri "https://google.com").StatusCode
Enter fullscreen mode Exit fullscreen mode

67. Monitor Website Every 10 Seconds

while ($true) {
    (Invoke-WebRequest "https://yoursite.com").StatusCode
    Start-Sleep -Seconds 10
}
Enter fullscreen mode Exit fullscreen mode

🌍 Quick and dirty uptime monitor.


68. Check SSL Certificate Expiry

$req = [Net.HttpWebRequest]::Create("https://google.com"); 
$req.GetResponse() | Out-Null; 
$req.ServicePoint.Certificate.GetExpirationDateString()
Enter fullscreen mode Exit fullscreen mode

📅 Avoid downtime by tracking SSL expiry.


69. Get AWS S3 Bucket Files (Requires AWS CLI)

aws s3 ls s3://mybucket --recursive
Enter fullscreen mode Exit fullscreen mode

70. Ping Multiple Hosts from a File

Get-Content hosts.txt | ForEach-Object {Test-Connection $_ -Count 1}
Enter fullscreen mode Exit fullscreen mode

✅ Super handy for network engineers.


🎉 Fun & Cool Hacks

71. Text-to-Speech (Jarvis Mode)

Add-Type AssemblyName System.Speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.Speak("Hello Kamal, I am your PowerShell assistant.")
Enter fullscreen mode Exit fullscreen mode

🎤 Make Windows talk back to you.


72. Matrix-Style Screen

while ($true) { Write-Host (Get-Random -Minimum 0 -Maximum 2) -NoNewline -ForegroundColor Green }
Enter fullscreen mode Exit fullscreen mode

🟢 Just for the geek vibes.


73. Fake Progress Bar

for ($i=0; $i -le 100; $i+=5) {
    Write-Progress -Activity "Hacking the mainframe..." -Status "$i% Complete" -PercentComplete $i
    Start-Sleep -Milliseconds 200
}
Enter fullscreen mode Exit fullscreen mode

😆 A harmless prank for friends.


74. Play a Beep Song

1..10 | % { [console]::beep((Get-Random -Minimum 200 -Maximum 2000), 200) }
Enter fullscreen mode Exit fullscreen mode

🎵 Random beep melodies.


75. Toggle Webcam On/Off

Get-CimInstance Win32_PnPEntity | Where-Object { $_.Name -match "Camera" } | Disable-PnpDevice -Confirm:$false
Enter fullscreen mode Exit fullscreen mode

🎥 Quickly disable webcam for privacy.


🏁 Conclusion

PowerShell is like an infinite toolbox — the more you explore, the more hidden gems you’ll find.

  • Part 1 gave you 55+ practical hacks for daily sysadmin, security, and automation tasks.
  • Part 2 showed you 20+ advanced tricks for dev workflows, forensics, cloud/DevOps, and even a few fun hacks.

Together, that’s a 75+ hack arsenal that makes you a true PowerShell ninja. 🥷

Top comments (0)