Skip to main content

Overview

The ps action enumerates running processes on local and remote systems, including process ID, name, owner, and command line. It queries the Win32_Process WMI class and invokes the GetOwner method to retrieve process ownership information.

Syntax

Parameters

Usage Examples

Example Output

Output Fields

Operational Use Cases

Scenario 1: Hunt for Admin Processes

Identify:
  • Processes owned by domain admins
  • Privileged service accounts
  • SYSTEM-owned processes
  • Interactive admin sessions

Scenario 2: Detect Security Tools

Look for:
  • AV processes (MsMpEng.exe, AvastSvc.exe)
  • EDR agents (CrowdStrike, Carbon Black)
  • Monitoring tools (Sysmon)
  • PowerShell activity

Scenario 3: Identify Credential Sources

Target processes:
  • lsass.exe (credential dumping)
  • Browser processes (saved passwords)
  • Password managers (KeePass, 1Password)
  • Database connections

Scenario 4: Post-Exploitation Verification

Confirm:
  • Beacon is running
  • Process ID and owner
  • Command line arguments
  • Parent process

Remote vs Local Usage

When to use:
  • Post-exploitation enumeration
  • Local process discovery
  • No remote access available
Advantages:
  • No network traffic
  • No authentication required
  • Faster execution

Detection Considerations

  • WMI queries for Win32_Process class
  • GetOwner method invocations
  • Event ID 5857: WMI activity
  • Sysmon Event ID 19-21: WMI operations
  • Process enumeration across multiple systems
  • Queries from non-administrative hosts
  • Bulk queries in short timeframe
  • Correlation with other enumeration
  • WMI/DCOM traffic on port 135
  • Multiple connections from single source

Best Practices

Operational Security

  • Limit query frequency
  • Blend with legitimate admin activity
  • Use during business hours
  • Avoid bulk enumeration

Data Analysis

  • Filter system processes
  • Focus on user-owned processes
  • Look for unusual command lines
  • Identify high-value targets

Filtering Process Output

Since SharpWMI returns all processes, you may want to filter results. Here are common targets:

Interesting Processes

  • PowerShell: powershell.exe, pwsh.exe
  • Credential Access: lsass.exe, mstsc.exe
  • Security Tools: MsMpEng.exe, cb.exe, falcon-sensor.exe
  • Browsers: chrome.exe, firefox.exe, msedge.exe
  • Shells: cmd.exe, conhost.exe

Troubleshooting

Cause: Insufficient privilegesSolution:
  • Use username and password parameters
  • Verify admin rights on target
  • Check UAC remote restrictions
Cause: GetOwner method failedSolution:
  • Some system processes don’t have owners
  • This is normal for SYSTEM processes
  • Check permissions if user processes show empty
Cause: Network or service issueSolution:
  • Verify target is online
  • Check firewall rules
  • Ensure WMI service is running

terminate

Kill processes by name or PID

query

Custom process queries

exec

Create new processes

loggedon

Enumerate logged-on users

Alternative Query Methods