DET-101 · human · confidence Medium
PowerShell History File Recreated Recently
The PowerShell command history file has a creation time newer than the user's first known PowerShell use.
PSReadLine keeps typed commands in ConsoleHost_history.txt under the user's AppData Roaming profile. If someone deletes the file, Windows recreates it the next time they open PowerShell, and the new file gets a fresh creation time. A creation date that is later than the first time that user ran PowerShell suggests the history was wiped. It is a cheap check that catches careless clean-up after hands-on-keyboard work such as data staging or tool use.
- Data sources
- EDR file telemetryEndpoint triage collection (file system metadata)PowerShell operational log
- Platforms
- Windows
Logic
1. Collect the Created and Modified times of %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt per user. 2. Find the earliest PowerShell launch for that user (Prefetch, EDR process events, Event 4104). 3. Flag when file Created > earliest launch by more than a day, or when EDR shows a delete of the file.
False positives
Profile resets, a reimaged laptop, or a user who cleared history after pasting a secret into the console.