Every shared folder eventually meets the same question: who deleted the file, and when. Windows Server answers it through the security event log, provided the audit policy was enabled before the incident. This article walks the complete setup: enabling the right audit categories, configuring the audit entry on the folder, reading the event stream, and recovering the content from shadow copies when the recycle bin is empty. It also covers the noise reduction tricks that keep the log readable at scale and the automation that turns raw events into a daily report.
The Audit Policy That Must Exist Before the Incident
The directory does not log what it is not told to log. The baseline policy lives in the security template or group policy under the audit object access category, and it has two subcategories that matter: file system and handle manipulation. Enabling both produces an event for every open, write, and delete that matches the folder's audit entry, and the volume is significant on a busy share. The practical compromise is to enable object access success and failure at the domain level, then restrict the actual audit entry to the folders that matter, because a domain-wide full audit fills the log in hours on a typical file server.
The audit entry on the folder itself is an access control entry of type audit, added on the security tab in advanced settings. The principal is Everyone, the type is Success, and the applies-to is This folder and files. The permissions to audit are Delete and Delete subfolders and files. The entry is additive, so existing permissions are untouched, and it takes effect immediately. A test delete by a non-administrator confirms the event appears: the deletion produces 4660, while the file path and access mask arrive in the preceding 4663, and often in 4656 for the handle open with delete access.
The Event Stream and How to Read It
Event 4660 carries the subject (the account that deleted), the handle ID, and the process ID, but not the file path or the access mask. Those live in the preceding 4663 object access event, and often in 4656 for the handle open, so the report joins 4660 to 4663 on the handle ID and a narrow time window. The subject includes the logon ID, which correlates to the logon event 4624 and reveals the session type, the source IP if network, and the elevation state. The practical read path is a filtered view in the event viewer or a PowerShell query that extracts the time, the account, the file, and the logon ID, then enriches the logon ID with the source details from 4624. A one-liner that does this for the last 24 hours is the daily report's backbone.
The noise reduction starts at the audit entry. Auditing only Delete and Delete subfolders and files excludes the read and write storms that dominate a file server. A second filter excludes system and service accounts whose deletions are expected, such as the cleanup tasks that remove temporary files. A third filter, applied at query time, excludes files in known temporary locations. The combined effect reduces the raw event count by two orders of magnitude on a typical share, turning a firehose into a readable stream.
Recovering the File From Shadow Copies
The audit tells who and when; the shadow copy tells what. The Volume Shadow Copy Service on the file server maintains previous versions of the folder on the schedule configured in the shadow copy tab, typically twice daily on business days. The recovery path is right-click the folder, previous versions, select the snapshot before the deletion, and copy the file out. The command line equivalent uses vssadmin list shadows to find the snapshot ID, then mounts or copies from the shadow copy path. The critical window is the time between the last snapshot and the deletion; if the file was created and deleted between snapshots, the shadow copy has no record of it, which is why the snapshot frequency is the real recovery point objective.
The automation that closes the loop is a scheduled task that runs a query for deletion events, enriches them with logon details, and emails the summary to the folder owners. The same task can check whether the deleted file exists in the most recent shadow copy and flag the ones that do not, which are the ones that require a backup restore. The report is one page, arrives every morning, and turns the question from a mystery into a ticket.
The most common silence is the missing audit policy, where the folder has the entry but the domain controller does not generate object access events. The second is the audit entry on the parent folder only, which does not inherit to the children because the inheritance flag was not set on the audit ACE. The third is the log size limit that wraps the security log before the incident is discovered, which is fixed by increasing the log size or forwarding to a collector. The fourth is the Advanced Audit Policy Configuration overriding the legacy policy, which is the modern way and must be configured instead of the legacy setting. The checklist of these four items catches ninety percent of the silent audits.
The PowerShell Query That Builds the Daily Report
The report that lands in the inbox every morning is a script that wraps the event query, the logon enrichment, and the shadow copy check into one email. The core query pulls 4663 events with DELETE access (0x10000) and joins them to 4660 by handle ID and time. 4660 supplies the deletion confirmation and subject; 4663 supplies the object path and access mask. Each result is parsed for the subject user, the object path, and the logon ID. The logon ID is then used to query event 4624 for the same logon ID, extracting the source network address, the logon type, and the elevation token. The shadow copy check uses vssadmin list shadows to find the most recent snapshot, then tests whether the deleted path exists in that snapshot's exposed path. The result is a table with columns: Time, User, File, Source IP, Logon Type, Recoverable From Shadow Copy. The script runs as a scheduled task at 06:00, emails the CSV, and logs its own execution to the application log so its absence is also visible.
The enrichment step is where the report earns its keep. A deletion by a service account at 03:00 from IP 0.0.0.0 with logon type 5 is a scheduled task, not a person. A deletion by a user at 14:30 from the remote access subnet with logon type 10 is a remote worker. A deletion by an account that has no recent 4624 is an account that logged on elsewhere and the session was already established. The report surfaces these distinctions without requiring the reader to open the event viewer, and the morning review becomes a five-minute scan rather than a forensic expedition.
A single file server is the easy case; a fleet of twenty is where the design earns its keep. The audit policy is deployed through group policy, the folder audit entries are applied by a configuration script that runs on each server, and the event forwarding is configured to send security events to a central collector. The collector runs the same daily query against the aggregated stream, and the report covers the entire estate. The configuration script is idempotent: it checks for the audit ACE, adds it if missing, verifies the policy subcategories are enabled, and writes its result to the local application log. The same script run as a daily scheduled task is the drift detector, alerting when a server has lost its audit entry or its policy.
The collector also enables the cross-server correlation that the single-server view misses. A user who deletes a file on server A and then creates a similar file on server B within minutes is a move disguised as a delete-and-create, and the centralized log makes the pattern obvious. The same correlation catches the insider who spreads deletions across servers to avoid triggering a single-server threshold alert. The collector's query is the same as the single-server query, just without the server name filter, and the report simply gains a Server column.
The audit trail starts with the policy and the event log:
auditpol /get /category:"Object Access"
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4663} -MaxEvents 20
The first command proves that object access auditing is enabled for the file system; the second returns the delete events with the account, the object name, and the process. Without the first, the second is empty.
## The Retention and Compliance Angle
The security log on a busy file server wraps in days if not forwarded, which means the audit trail evaporates before an annual review. The forwarding to a collector with a retention policy of one year, or to a SIEM with seven years, turns the operational log into a compliance artifact. The compliance officer asks for proof that deletions are audited, and the answer is the collector's retention policy, the daily report archive, and the quarterly spot check that verifies a sample deletion appears in both the daily report and the collector. The spot check is a manual exercise: pick a file, delete it, wait for the morning report, verify the entry, verify the collector has it, and sign the checklist. The quarterly cadence is light enough to sustain and heavy enough to catch drift.
The compliance angle also shapes the audit entry. Auditing only Delete is the operational minimum, but some frameworks require auditing Take Ownership, Change Permissions, and Write Attributes as well. The additional events increase the volume, and the collector's retention budget decides the trade-off. The pragmatic compromise is to audit Delete and Take Ownership on all shares, and the full suite only on the shares that hold regulated data. The regulator sees the configured audit policy, the daily report, and the spot check log, and the organization passes the audit without a dedicated compliance project.
The Automation That Keeps the Audit Alive
The audit that survives a year is the one that has a heartbeat. The heartbeat is a scheduled task on the collector that runs a tiny validation: it creates a test file on a monitored share, deletes it, waits for the event to appear in the forwarded log, and logs success or failure. If the heartbeat fails three times, it alerts. The same task also verifies that the daily report was sent and that the collector's disk has headroom. The heartbeat is the canary, and the canary is the only reason the audit survives the reorg that moves the file server, the upgrade that changes the group policy, and the administrator who forgets the audit entry exists. The organizations that have a heartbeat keep the audit; the ones that do not rediscover the silence at the worst possible moment.
A file renamed instead of deleted produces no 4660, only a 4663 with write attributes, and the report that only watches 4660 misses it. The fix is to also audit Write Attributes on the sensitive shares, or to run a parallel query for 4663 with a write-attributes mask. A file deleted from the command line with a wildcard produces one 4660 per file, and the report sees a burst; the burst detector in the daily script flags the pattern so the reviewer does not have to count lines. A file deleted by a process running as SYSTEM appears with the computer account as the subject, and the logon ID correlates to a service startup; the report marks these as system actions and excludes them from the user deletion count, unless the service account is one that should not be deleting files. A file deleted over SMB by a non-Windows client, from a Linux or macOS machine, produces the same 4660 with the authenticated user as the subject, because the SMB server translates the client identity to a Windows token before the audit. The audit works across platforms because the server is the authority.
The recursive delete of a folder tree produces one 4660 per object, with a matching 4663 that supplies each path, and the event order is depth-first. The report groups by parent folder and presents the folder deletion as the headline with the file count as the detail, which is the view the reviewer expects. The folder deletion itself does not carry the list of contained files, so the grouping is a reconstruction from the timestamps and the path prefix, and it is accurate enough for the daily review. The edge case that defeats the grouping is the delete that spans midnight, where the folder delete is before midnight and some file deletes are after; the report handles this by using the logon ID and the parent path rather than the date boundary, which is why the logon ID is the primary key in the report's internal structure. The audit that is configured, forwarded, reviewed, and heart-beated is the one that answers the question when it is asked, and the one that is not is the one that becomes the story of the incident that had no witnesses.