By Gerard King | www.gerardking.dev
PowerShell is a powerhouse for Windows system administration, but many potent one-liners often fly under the radar — overlooked in official docs yet critical for deep system control. Whether you're a sysadmin, security analyst, or threat hunter, mastering these commands can reveal hidden insights and empower you to manage Windows environments comprehensively.
Below is a curated list of powerful, frequently ignored PowerShell idioms that enable enumeration, manipulation, and control of various Windows components. Use these to elevate your operational awareness or bolster your defense strategy.
Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine,Name
Why: Unlike Get-Process, this reveals the full command line arguments for every running process, helping detect suspicious or stealthy activity.
Get-CimInstance Win32_Service | Select-Object Name,State,StartMode,PathName
Why: Knowing the service binaries’ paths exposes potentially malicious services running from unusual locations.
Get-ScheduledTask | Select-Object TaskName,State,Actions,Triggers
Why: Scheduled tasks are common persistence mechanisms; checking them uncovers hidden automation and execution points.
Get-LocalUser | Select-Object Name,Enabled,LastLogon
Why: Identifies inactive, rogue, or recently active user accounts—key for insider threat detection.
Get-ChildItem Env:
Why: Environment variables can affect application behavior or conceal malicious payload paths.
Get-WinEvent -ListLog * | ForEach-Object { Export-Clixml -InputObject (Get-WinEvent -LogName $_.LogName -MaxEvents 100) -Path "$($_.LogName).xml" }
Why: Deep forensic insight into system, security, and application logs for attack investigation.
Get-NetTCPConnection | Select-Object LocalAddress,LocalPort,RemoteAddress,RemotePort,State,@{Name="ProcessName";Expression={(Get-Process -Id $_.OwningProcess).Name}}
Why: Correlates network activity to processes, aiding detection of unusual communication or data exfiltration.
Get-Module -ListAvailable | Select-Object Name,Version,Path
Why: Identifies unauthorized or malicious modules loaded or available in the environment.
Get-ChildItem "C:\Program Files" -Recurse -Filter *.exe | ForEach-Object { $_.FullName; (Get-AuthenticodeSignature $_.FullName).Status }
Why: Detects tampered or unsigned executables potentially involved in supply-chain or local compromise.
$command = 'Get-Process'; $bytes = [System.Text.Encoding]::Unicode.GetBytes($command); $encoded = [Convert]::ToBase64String($bytes); Write-Output $encoded
Why: Encoded commands evade simple text-based detection; understanding this is essential for offense and defense.
These PowerShell one-liners expose fundamental “under-the-hood” Windows system details that Microsoft documentation might underplay but are invaluable for administrators, security professionals, and threat actors alike. Mastery and monitoring of these commands are key to full-spectrum operational awareness.
For more insights and deep-dives, visit www.gerardking.dev.
If you'd like, I can help format this for your website CMS or suggest SEO optimizations next! How’s this looking?