- Windows
- Cybersecurity
- Intermediate
- 12 min read
This Windows forensics cheat sheet collects the commands, event IDs and files you need when a Windows PC or server may have been hacked. It follows the order a real investigation takes: save the evidence, see who and what is running, find how the attacker stays on the machine, read the logs, then build a timeline and find the root cause.
Last updated: December 2026
In short
- Collect memory first, because it is gone after a restart. Then copy the disk and the logs.
- Most attackers leave traces in the same few places: autostart entries, services, scheduled tasks and the Security event log.
- The built-in Windows commands were tested on Windows 11. Each code box says where it runs and whether it needs admin rights.

Before you type anything
Every command you run changes the machine a little: it starts a process, writes to the prefetch folder and adds log entries. On a machine that may end up in court or an insurance claim, capture memory and a disk image first and do the deep analysis on the copies. Save output to a USB drive or a network share, never to the suspect disk. Run these commands only on systems you own or are allowed to investigate.
Which Windows Versions This Covers
The commands and file paths are for Windows 10, Windows 11 and Windows Server 2016 or newer (the packet capture in step 7 needs Windows 10 version 2004, Windows 11 or Windows Server 2022). Most artifacts also exist on Windows 7, but Windows 7 lost support in January 2020 and lacks some tools used here. To open an admin window, right-click Start and choose Terminal (Admin).
The Windows Forensics Cheat Sheet at a Glance
query userWho is signed in right nownet localgroup administratorsWho has admin rightstasklist /vEvery running processnetstat -anoOpen connections and the process behind eachschtasks /query /fo LIST /vEvery scheduled taskGet-WinEvent -FilterHashtableLogons, new accounts and new services
Tap a command to jump to it. “admin” = run it in an administrator window to see everything.
Step 1: Quick Triage Commands
Triage answers three questions in a few minutes: who is on the machine, what is running, and what is it talking to. These are built into Windows, so they work even when you cannot install anything.
01 query user: Who Is Signed In
Lists every session on the machine, including Remote Desktop ones, with the time each user signed in. A session you cannot explain, especially an RDP one at night, is worth a closer look.
query userquery user is missing on Windows Home editions. It also returns exit code 1 even when it works, so do not rely on the exit code in scripts.
02 net user and net localgroup: Accounts and Admins
Attackers like to add a quiet local account and put it in the Administrators group. Compare these two lists with the accounts you expect.
net usernet localgroup administrators03 tasklist: Running Processes
/v adds the user that owns each process. /svc shows which services live inside each process, which helps when one svchost.exe is using the network.
tasklist /vtasklist /svcTo also see the full command line and the parent process, use Get-CimInstance Win32_Process, explained in our PowerShell guide for a hacked PC.
04 netstat -ano: Connections and Their Process IDs
Shows every open port and connection with the process ID (PID) in the last column. Match the PID with tasklist to find the program. Look for connections to unknown public IP addresses and for programs listening on ports you did not open.
netstat -anoGet-NetTCPConnection -State Established | Select-Object LocalPort, RemoteAddress, RemotePort, OwningProcess05 ipconfig /displaydns: Recently Looked-Up Domains
The DNS cache lists domains the machine resolved recently. A strange domain here can point to malware calling home. The cache is cleared on restart, so read it early. On our Windows 11 test PC this command needed an admin window.
ipconfig /displaydnsStep 2: Registry Hives and Key Artifacts
The registry is stored in a few files called hives. Windows keeps them locked while it runs, so forensic tools copy them or you export them with reg save. Our guide to Windows directories for SOC analysts shows where each file lives.
| Hive | File on disk | What it tells you |
|---|---|---|
HKLM\SAM | C:\Windows\System32\config\SAM | Local accounts and their groups |
HKLM\SECURITY | C:\Windows\System32\config\SECURITY | Local security policy and stored LSA secrets |
HKLM\SOFTWARE | C:\Windows\System32\config\SOFTWARE | Installed programs and machine-wide autostart keys |
HKLM\SYSTEM | C:\Windows\System32\config\SYSTEM | Services, drivers, USB devices, computer name |
HKCU (one per user) | C:\Users\<user>\NTUSER.DAT | That user’s settings, recent files, typed paths and Run box history |
Part of HKCR | C:\Users\<user>\AppData\Local\Microsoft\Windows\UsrClass.dat | ShellBags: folders the user opened, even on removed drives |
| Amcache | C:\Windows\AppCompat\Programs\Amcache.hve | Programs that were present, with their SHA1 hash. Not proof that they ran. |
These keys are where attackers most often hide programs that should start on their own:
| Key | Why it matters |
|---|---|
Software\Microsoft\Windows\CurrentVersion\Run (HKLM and HKCU) | Starts a program at every sign-in |
...\CurrentVersion\RunOnce | Starts a program once, at the next sign-in |
HKLM\SYSTEM\CurrentControlSet\Services | Every service and driver, with the file it runs |
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options | A Debugger value here runs another program instead of the real one |
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs | DLLs loaded into many programs. Windows ignores it when Secure Boot is on. |
To show that a program actually ran, and when, combine several of these execution artifacts. No single one is proof on its own:
| Artifact | Where | What it shows |
|---|---|---|
| Prefetch | C:\Windows\Prefetch\*.pf | Programs that ran, how many times, and recent run times. Often turned off on servers. |
| UserAssist | NTUSER.DAT | Programs a user started from Explorer or the Start menu, with a run count. The names are ROT13-encoded. |
| BAM | SYSTEM\CurrentControlSet\Services\bam | Last run time of programs, per user (Windows 10 version 1709 and later) |
| Shimcache | SYSTEM hive (AppCompatCache) | Programs Windows checked for compatibility. Shows the file existed, not that it ran. |
| SRUM | C:\Windows\System32\sru\SRUDB.dat | Roughly hourly app and network use, useful for spotting large uploads |
06 reg query: Read a Key
Reads the values of one key. Add /s to include every subkey below it.
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Runreg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run07 reg save: Export a Hive for Later
Copies a whole hive to a file you can open on your analysis machine with Registry Explorer or RegRipper. Point the output to your evidence drive (here E:), not to the suspect disk.
reg save HKLM\SYSTEM E:\evidence\SYSTEM.hiv08 reg load and reg unload: Open a Copied User Hive
Mounts a copied NTUSER.DAT under a temporary name so you can browse it with reg query or Registry Editor. Unload it when you finish. Work on a copy: loading a hive can change it.
reg load HKU\Case1 E:\evidence\NTUSER.DATreg unload HKU\Case1Step 3: Persistence and Autostart Checks
Persistence is how an attacker gets back in after a restart. Check these five places on every case:
Scheduled Tasks
Run a program at a set time, at startup or at sign-in. Look for odd names and actions that start scripts.
Services
Run as SYSTEM before anyone signs in. A service whose file sits in Temp or AppData is a red flag.
Run and RunOnce Keys
The registry keys from step 2. Check both the machine (HKLM) and every user (HKCU).
Startup Folders
Shortcuts in shell:startup and shell:common startup run at sign-in. Note anything added recently.
WMI Event Subscriptions
Run a command when something happens, with no file in the usual places. Autoruns lists them on its WMI tab.
09 schtasks: Every Scheduled Task in Detail
The “Task To Run” line shows the program each task starts. Long PowerShell commands or files in user folders are the ones to check first.
schtasks /query /fo LIST /v10 Services and the File Each One Runs
sc query lists every service and its state (the space after each = is required). The PowerShell line adds the start mode and the file path. Many older cheat sheets use wmic service here, but Microsoft is removing WMIC from Windows 11 (it is off by default since version 24H2, and our 26H2 test PC no longer has it), so use PowerShell instead.
sc query type= service state= allGet-CimInstance Win32_Service | Select-Object Name, StartMode, State, PathName11 Autoruns: Every Autostart Location at Once
Autoruns checks more autostart places than any manual list, including WMI and browser add-ons. autorunsc is its command-line version: -a * means all entry types, -c CSV output, -h file hashes and -s signature checks. Unsigned entries are the first to review.
autorunsc -accepteula -a * -c -h -s > E:\evidence\autoruns.csvStep 4: Windows Event Logs and Event IDs
Event logs are .evtx files in C:\Windows\System32\winevt\Logs. These are the event IDs most investigations start with:
| Event ID | Log | Meaning |
|---|---|---|
| 4624 | Security | Successful sign-in. Check the logon type: 2 = at the keyboard, 3 = over the network, 10 = Remote Desktop. |
| 4625 | Security | Failed sign-in. Many in a row from one source suggests password guessing. |
| 4672 | Security | A sign-in was given sensitive privileges, such as SeDebugPrivilege. Normal for SYSTEM and admins; investigate it for an ordinary user. |
| 4720 | Security | A user account was created |
| 4732 | Security | A member was added to a local group, such as Administrators |
| 4688 | Security | A process started (only if process auditing is turned on) |
| 1102 | Security | The Security log was cleared, often to hide tracks |
| 7045 | System | A new service was installed |
| 4104 | PowerShell Operational | The text of a PowerShell script block that ran (every block only if Script Block Logging is turned on) |
| 1116, 1117 | Defender Operational | Microsoft Defender found malware (1116) and acted on it (1117) |
12 Get-WinEvent: Filter Events by ID
Get-WinEvent has no -Id parameter on its own, so a line like Get-WinEvent -Id 4624 fails. Put the log name and IDs in -FilterHashtable instead.
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624,4625,4720,4732} -MaxEvents 50Get-WinEvent -FilterHashtable @{LogName='System'; Id=7045} -MaxEvents 2013 wevtutil: Read or Export Logs from Command Prompt
The first line shows the 20 newest System events as text (/rd:true means newest first). The second exports the whole Security log to your evidence drive for tools like Hayabusa or Timeline Explorer.
wevtutil qe System /c:20 /rd:true /f:textwevtutil epl Security E:\evidence\Security.evtxStep 5: Deleted Files and File Carving
A deleted file can often be recovered until Windows reuses its space on the disk.
| Where or what | What you can recover |
|---|---|
C:\$Recycle.Bin\<user SID> | Files in the Recycle Bin. Each $I file stores the original path and the deletion time. |
| Volume Shadow Copies | Older versions of files, if restore points exist. Ransomware often deletes them first. |
The Sleuth Kit (fls, icat) | Deleted NTFS entries listed and copied out of a disk image |
| PhotoRec, Scalpel | Files carved from empty space by their file signatures, even without a name |
14 vssadmin: List Shadow Copies
vssadmin list shadowsIf this lists nothing on a server that normally keeps restore points, ask why. vssadmin delete shadows in a process or event log is a strong ransomware sign.
15 fls and icat: Find and Copy Out Deleted Files
fls -r -d walks every folder and lists only deleted entries, each with an address such as 1234-128-1. icat copies that entry’s content to a new file.
fls -r -d disk.rawicat -r disk.raw 1234-128-1 > recovered.binIf the image holds a whole disk instead of one partition, add -o with the partition’s start sector (find it with mmls disk.raw).
16 Get-FileHash: Fingerprint a Suspicious File
Hash files before and after you copy them to prove they did not change, and look the SHA256 up in VirusTotal or your threat intelligence tool.
Get-FileHash E:\evidence\recovered.bin -Algorithm SHA256Step 6: Memory Capture and Analysis
RAM holds things the disk never sees: malware that runs only in memory, open network connections, decrypted data and sometimes passwords. It is lost when the machine powers off, so capture it before anything else. Run the capture tool from a USB drive as administrator and write the dump to that drive.
| Tool | What it does |
|---|---|
| FTK Imager | Free GUI tool; File › Capture Memory. Also makes disk images. |
| Magnet RAM Capture | Free, one window, one button |
| Belkasoft Live RAM Capturer | Free, small, runs from USB |
| WinPmem | Open source, command line, good for scripts |
pagefile.sys, hiberfil.sys | Parts of old memory saved on disk. Collect them with the disk image, especially when a live capture was not possible. |
Then analyze the dump with Volatility 3, a free Python tool that runs on Windows, Linux and macOS:
| Plugin | What it shows |
|---|---|
windows.pslist, windows.pstree | Processes, and which one started which |
windows.psscan | Processes found by scanning memory, including hidden or ended ones |
windows.cmdline | The command line of each process |
windows.dlllist, windows.ldrmodules | Loaded DLLs, and DLLs hidden from the normal lists |
windows.netscan | Network connections and listening ports at capture time |
windows.registry.hivelist | Registry hives in memory |
windows.malfind | Memory that is both writable and executable, a common sign of injected code |
17 vol: Run a Volatility 3 Plugin
Start with the process tree. A Word or browser process with cmd.exe or powershell.exe under it is suspicious.
vol -f memory.raw windows.pstreevol -f memory.raw windows.netscanPlugin names change between releases (newer versions also list some under windows.malware.). Run vol -h to see the names your version has.
Step 7: Network Activity and Data Theft
Before stealing data, attackers usually collect it in one place and pack it, then send it out with a tool that is already on the machine. Watch for these signs:
| Sign | Why it matters |
|---|---|
Large new .zip, .7z or .rar files in Temp, ProgramData or a user folder | Data gathered and packed before it leaves |
certutil -urlcache, bitsadmin /transfer, curl.exe | Built-in Windows tools that can download or upload files |
powershell -EncodedCommand (or -enc) | A hidden command; decode it from Base64 to read it |
| Connections to unknown IPs, often at regular intervals | Possible command-and-control traffic |
| Uploads to personal cloud storage | OneDrive, Dropbox or Google Drive used to move data out |
18 pktmon: Capture Traffic Without Installing Anything
Packet Monitor (Microsoft docs) is built into Windows 10 version 2004 and later, Windows 11 and Windows Server 2022. Start a capture, reproduce the activity, then stop it. By default each packet is cut to 128 bytes; add --pkt-size 0 to keep whole packets.
pktmon start --capture --pkt-size 0pktmon stopThe capture is saved as PktMon.etl in the current folder. This turns it into a file Wireshark opens:
pktmon etl2pcap PktMon.etlStep 8: Build the Incident Timeline
A timeline puts every event from every source in one list sorted by time. It shows the story: first sign-in, download, first run, persistence, then data theft. Attackers sometimes change file times (timestomping), so confirm important times with a second source, such as an event log entry.
| Tool | Use it for |
|---|---|
Plaso (log2timeline.py, psort.py) | One timeline from the MFT, event logs, registry, browser history and more |
| MFTECmd | Reading the NTFS Master File Table into CSV, with created, modified, accessed and changed times |
fls -r -m C: disk.raw and mactime (The Sleuth Kit) | A quick file-system-only timeline |
| Timesketch | Searching and tagging a large timeline with your team |
19 log2timeline and psort: A Full Timeline
The first command reads the image and saves every event it finds. The second writes them to a CSV file you can filter in Timeline Explorer or load into Timesketch.
log2timeline.py --storage-file case1.plaso disk.E01psort.py -o dynamic -w case1-timeline.csv case1.plasoStep 9: Find the Root Cause
Before you close the case, find out how the attacker got in, so you can block that path for good.
Define the incident. What happened, when it was noticed and which systems are involved.
Gather and connect the data. Logs, EDR or SIEM alerts, the artifacts above and what users report.
Rebuild the timeline from the first sign of access to the last action you can see.
Ask “why” until you reach a cause you can fix. “Malware ran” is a symptom; “the RDP port was open to the internet with a weak password” is a cause.
Fix it and write it down. Short-term clean-up, long-term changes, and what to detect earlier next time.
In most cases the cause is one of these: a phishing email, a stolen or weak password, a missing security update, or a wrong setting such as an exposed remote access port. Tools such as Sysmon, Velociraptor and KAPE help collect the evidence across many machines; see our guide to SOC tools for how they fit with a SIEM and EDR.
Which Operating System Runs These Tools
| Tool or command | Windows | Linux | macOS |
|---|---|---|---|
| query user, net, tasklist, netstat, schtasks, sc, reg, wevtutil, vssadmin, pktmon | Built in | No | No |
| Get-WinEvent, Get-CimInstance, Get-NetTCPConnection, Get-FileHash | Built in (PowerShell) | Get-FileHash only, with PowerShell 7 | Get-FileHash only, with PowerShell 7 |
| Autoruns, FTK Imager, Magnet RAM Capture, WinPmem | Yes | No | No |
| Volatility 3, The Sleuth Kit | Yes | Yes | Yes |
| Plaso | Docker or WSL | Yes | Docker |
A ready-made lab
Free forensic Linux builds such as the SANS SIFT Workstation come with Volatility, The Sleuth Kit and Plaso installed. On a Windows analysis PC, WSL can run the Linux tools too.
Key takeaways
- Capture memory first, then the disk, and analyze the copies.
- Triage with built-in commands: users, processes, connections and the DNS cache.
- Check every persistence place: tasks, services, Run keys, startup folders and WMI.
- Use
Get-WinEvent -FilterHashtablefor event IDs such as 4624, 4625, 4720 and 7045. - Finish with a timeline and a root cause you can fix.
FAQ
What is a Windows forensics cheat sheet?
A one-page reference of the commands, event IDs and file locations an investigator needs on a Windows machine, in the order they are used. This one is tested on Windows 11 and says where each command runs.
What should I collect first in Windows forensics?
Memory, because it disappears when the machine powers off. Then network state and running processes, then the disk image and logs. RFC 3227 calls this the order of volatility.
Should I turn off a hacked Windows PC?
Not before you capture memory, if you can. Disconnect it from the network instead, so the attacker loses access but the evidence in RAM stays.
Why does Get-WinEvent -Id not work?
Get-WinEvent has no stand-alone -Id parameter. Use -FilterHashtable @{LogName='Security'; Id=4624}, which is also much faster than filtering afterwards.
Does Amcache prove that a program ran?
No. Amcache shows that a program was present on the system. Use prefetch files, event 4688 or Sysmon event 1 to show that it actually ran.
Is WMIC still useful for forensics?
Not on new systems. Microsoft is removing WMIC from Windows 11, and it is off by default since version 24H2. The PowerShell Get-CimInstance commands give the same information.
For the full list of fields in a sign-in event, see Microsoft’s page on event 4624. The order of evidence collection comes from RFC 3227, Guidelines for Evidence Collection and Archiving.
Inspired by a Windows forensics cheat sheet shared by anastasis_king. Commands tested and text written by infotechtu.com.
Related guides on infotechtu.com
Share this guide
Get new guides by email
One short email when a new guide is out. Unsubscribe at any time.
