Determine Which Users Are Running Which Processes
Query
// Use Case: Identifying and analyzing unique processes executed by Windows user accounts while sorting the results by user and process name for security or auditing purposes.
Process
| project WindowsUserAccount, ProcessName, ProcessId, CommandLine
| distinct WindowsUserAccount, ProcessName, ProcessId, CommandLine
| order by WindowsUserAccount, ProcessNameExplanation
This query is designed to help identify and analyze the unique processes that have been executed by Windows user accounts. Here's a simple breakdown of what it does:
-
Selects Specific Data: It focuses on four key pieces of information from the
Processdata: the Windows user account, the process name, the process ID, and the command line used to start the process. -
Filters for Uniqueness: It ensures that each combination of user account, process name, process ID, and command line is unique. This means it removes any duplicate entries from the results.
-
Sorts the Results: Finally, it organizes the data by sorting it first by the Windows user account and then by the process name.
Overall, this query helps in auditing or security analysis by providing a clear and organized view of the distinct processes run by each user on a Windows system.
Details

Ugur Koc
Released: December 13, 2024
Tables
Keywords
Operators