Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Command-line auditing records the full argument string of every process that starts. Without it, a log shows that PowerShell ran; with it, you can see exactly what PowerShell was told to do.

What Is Command-Line Auditing?
Command-line auditing is the recording of the complete command used to launch a process, arguments included. The difference it makes is stark. A log entry saying powershell.exe started is almost worthless, because PowerShell starts thousands of times a day in a normal estate. An entry showing powershell.exe -nop -w hidden -enc SQBFAFgAIAAo... is a detection on its own.
Two settings are required, and enabling only the first is a common mistake. In Group Policy, switch on Audit Process Creation under Advanced Audit Policy Configuration to generate event 4688, then enable Include command line in process creation events under Administrative Templates, System, Audit Process Creation. Without the second, you get the process name and nothing more.
Sysmon provides a richer alternative. Its event ID 1 includes the command line, the parent process and its command line, the image hash, the signing status, and the originating user, which makes parent-child analysis possible in a way that 4688 alone does not support. The widely used configurations from Olaf Hartong and SwiftOnSecurity are sensible starting points, though both need trimming to your estate.
For scripting activity, add PowerShell Script Block Logging, which records the deobfuscated contents of executed script blocks as event 4104. It is the only reliable way to see what encoded and obfuscated commands actually do, and it survives most of the evasion techniques aimed at command-line logging.
On Linux, the kernel audit subsystem captures execution through rules such as:
-a always,exit -F arch=b64 -S execve -k exec
-a always,exit -F arch=b32 -S execve -k exec
That produces EXECVE records containing each argument, searchable with ausearch -k exec. The volume is substantial on busy servers, so pair it with exclusions for high-frequency benign binaries and consider an eBPF-based collector instead, which gives similar visibility at lower cost and is covered under eBPF. On macOS, the Endpoint Security framework provides the equivalent stream to EDR agents.
-enc, -e, or base64 strings in arguments.certutil -urlcache -f, bitsadmin /transfer, regsvr32 /i:http, rundll32 with a remote path, and mshta fetching a script.vssadmin delete shadows or wmic shadowcopy delete, one of the strongest ransomware precursors available.comsvcs.dll MiniDump for LSASS and ntdsutil on domain controllers.whoami, net group "domain admins", nltest, and systeminfo running within seconds of each other from the same parent.Command lines capture secrets. Administrators pass passwords as arguments, deployment scripts include connection strings, and API keys appear in automation. Once collected, those values sit in your SIEM in plain text, searchable by everyone with access to it, for as long as your retention policy says.
Deal with it deliberately. Apply masking patterns in the ingestion pipeline for arguments that follow -p, --password, pwd=, and similar forms. Restrict access to the index holding process events more tightly than to general log data. Record the decision in your data protection documentation, because under the UK GDPR this is employee personal data processed for security purposes and the ICO expects the monitoring to be proportionate, documented, and disclosed to staff through an employee monitoring policy.
Volume also needs planning. Process creation is usually the largest single source in an estate, and it drives both licence cost and retention decisions. Collect it everywhere, keep it hot for 30 to 90 days, and archive the rest rather than filtering at source, since filtered events are the ones an investigation always wants.
Event 4688 with command-line inclusion enabled covers the basics and requires no extra software, which matters on servers with change control. Sysmon adds parent command line, image hashes, signature status, network connections, and DNS queries correlated to the same process, and it is far easier to build reliable detections on. Many organisations enable 4688 estate-wide and deploy Sysmon to higher-value systems.
It is usually the largest single source. A typical workstation produces a few thousand process events a day, and busy servers far more, so a mid-sized estate can add tens of gigabytes daily. Plan the pipeline before enabling it: tune noisy benign binaries, use a tiered storage model with a hot searchable window and cheaper archive, and measure the cost against the detection value.
Partly. Arguments can be obfuscated, passed through environment variables, or supplied over a named pipe rather than on the command line, and some tooling patches the logging mechanism itself. Script block logging defeats most obfuscation because it records the deobfuscated content, and detections built on parent-child relationships and process behaviour remain effective when the argument string is deliberately uninformative.
Assume they will be, because administrators and automation routinely pass credentials as arguments. Mask known patterns during ingestion, restrict access to the process event index more tightly than to other logs, rotate any credential discovered in the clear, and cover the collection in your employee monitoring policy and privacy notice so the processing is documented and proportionate.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.