Getting Started
SharpWMI uses a consistent command-line syntax with anaction parameter to specify the operation:
Basic Syntax
- Local Operations
- Remote Operations
Enumeration Workflows
User Enumeration
Identify logged-on users across the network:Process Enumeration
List running processes with owner information:Firewall Enumeration
Enumerate firewall rules and open ports:Advanced WMI Queries
Network Connections (Windows 10+)
Network Connections (Windows 10+)
netstat.Installed Software
Installed Software
User Accounts
User Accounts
Scheduled Tasks
Scheduled Tasks
AntiVirus Detection
AntiVirus Detection
Execution Workflows
Basic Process Creation
Execute commands on remote systems:Command Output Retrieval
Capture command output from remote execution:The
result=true option stores command output in a WMI environment variable, retrieves it, and cleans up. This adds execution time but provides valuable feedback.VBScript Execution
Execute VBScript payloads through WMI event subscriptions:- Execute Command
- Download & Execute
- Execute Script File
- Timing Options
File Operations
File Upload
Upload files to remote systems via WMI:- Creates temporary WMI class with file data in property
- Executes PowerShell on target to read from WMI class
- Writes bytes to disk
- Verifies upload success
- Removes temporary WMI class
MSI Installation
Install MSI packages remotely:The MSI file must be accessible from the target system. Use UNC paths or ensure the file exists locally on the target.
Process Management
Terminate Processes
Kill processes by name or PID:Environment Variable Management
Get Environment Variables
Retrieve environment variable values:Set Environment Variables
Create or modify environment variables:Environment variables are set in the user context. Use this for data exfiltration or configuration settings.
Delete Environment Variables
Remove environment variables:Operational Scenarios
Scenario 1: Initial Access and Enumeration
Scenario 1: Initial Access and Enumeration
Scenario 2: Lateral Movement with File Upload
Scenario 2: Lateral Movement with File Upload
Scenario 3: Credential Harvesting
Scenario 3: Credential Harvesting
Scenario 4: Mass Enumeration
Scenario 4: Mass Enumeration
Scenario 5: Persistence via Scheduled Task
Scenario 5: Persistence via Scheduled Task
Best Practices
Operational Security
- Use AMSI evasion for PowerShell/VBScript operations
- Clean up artifacts (environment variables, WMI classes)
- Randomize event names for VBScript execution
- Use result=true sparingly (creates more artifacts)
Credential Management
- Avoid hardcoding credentials in commands
- Use domain admin accounts only when necessary
- Consider using current user context where possible
- Rotate compromised credentials promptly
Network Operations
- Test connectivity before mass operations
- Handle timeouts gracefully
- Limit concurrent targets to avoid detection
- Monitor for defensive responses
Error Handling
- Check for access denied errors
- Verify WMI service is running on targets
- Ensure firewall allows RPC/DCOM traffic
- Validate credentials before mass operations
Common Issues and Solutions
Access Denied
Access Denied
Error: Access denied when connecting to remote systemCauses:
- Insufficient privileges
- Wrong credentials
- WMI permissions not granted
- UAC filtering (local admin but not elevated)
- Verify credentials with
usernameandpassword - Use domain admin account
- Add user to local Administrators group on target
- Disable UAC remote restrictions (if appropriate)
No Results Returned
No Results Returned
Error: Command executes but no results/outputCauses:
- Insufficient privileges for result retrieval
- Environment variable creation failed
- Command didn’t produce output
- Verify admin access to target
- Check command syntax
- Use
result=trueonly with commands that produce output - Test command locally first
AMSI Evasion Failed
AMSI Evasion Failed
Error: AMSI still blocks execution despite
amsi=disableCauses:- Insufficient privileges to modify registry
- AMSI evasion detected by EDR
- Registry protection in place
- Verify admin privileges
- Use alternative AMSI bypass methods
- Consider different execution techniques
- Test AMSI bypass manually first
Next Steps
Action Reference
Explore all available actions in detail
WMI Queries
Advanced WMI query examples
Remote Execution
Process creation techniques
VBScript Execution
VBScript payload delivery