Windows Servers

Windows File and Folder Auditing: Track File Access

By NileVPS Team · Published · 4 min read

اقرأ المقال بالعربي

Sooner or later someone asks a question that permissions alone cannot answer: who deleted this folder, who changed that spreadsheet, or which account keeps trying to open a confidential file? Windows Server can answer it through file system auditing, which writes an entry to the Security log whenever a monitored file is accessed in a way you choose. Auditing is built in and free, but it has to be configured in two places, and it can flood your logs if you enable it carelessly. This guide shows a clean setup that records what matters and nothing more.

How file auditing works

Auditing needs two pieces, and neither does anything without the other:

  1. The audit policy tells Windows to record file system events at all.
  2. A SACL (System Access Control List) on a specific folder or file defines whose actions, and which actions, are recorded.

Events are written to the Security log in Event Viewer. Auditing only works on NTFS (or ReFS) volumes.

Step 1: Enable the audit policy

On a standalone server, open gpedit.msc (or secpol.msc) and go to:

Computer Configuration > Windows Settings > Security Settings > Advanced Audit Policy Configuration > System Audit Policies > Object Access > Audit File System

Enable Success and, if you want failed attempts too, Failure. You can do the same from an elevated prompt:

auditpol /set /subcategory:"File System" /success:enable /failure:enable
auditpol /get /subcategory:"File System"

In a domain, configure the same setting in a GPO linked to the file servers' OU. Avoid mixing the legacy "Audit object access" setting with the advanced policy; if you use advanced subcategories, also enable "Audit: Force audit policy subcategory settings to override audit policy category settings" under Security Options.

Step 2: Add auditing entries to the folder

  1. Right-click the folder you want to monitor and open Properties > Security > Advanced.
  2. Open the Auditing tab and click Add.
  3. Select a principal, usually Everyone or a specific group.
  4. Choose the type: Success, Fail or All.
  5. Click Show advanced permissions and select only what you need.

A sensible set for most file shares:

PermissionWhy audit it
Create files / write dataDetect new files and modifications
Delete and Delete subfolders and filesFind out who removed data
Change permissionsCatch permission tampering
Take ownershipCatch ownership changes

Auditing "Read data" on a busy share generates a huge number of events. Enable it only on genuinely sensitive folders.

You can also inspect the SACL with PowerShell:

(Get-Acl -Path "D:\Shares\Finance" -Audit).Audit

Step 3: Read the events

The key Security log event IDs are:

Event IDMeaning
4656A handle to an object was requested
4663An attempt was made to access an object (the main one)
4660An object was deleted
4670Permissions on an object were changed
4658The handle to an object was closed

Event 4663 contains the account name, the object path, the process that accessed it and the access type, such as WriteData or DELETE. A deletion usually appears as a 4663 with DELETE access followed by a 4660 with the same Handle ID, so match them by handle to get the file name.

PowerShell makes searching much faster than scrolling:

Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4663; StartTime=(Get-Date).AddDays(-1)} |
  Where-Object { $_.Message -like '*D:\Shares\Finance*' } |
  Select-Object TimeCreated, @{n='User';e={$_.Properties[1].Value}}, @{n='Object';e={$_.Properties[6].Value}} |
  Format-Table -AutoSize

For a broader look at filtering and custom views, see our Event Viewer guide.

Step 4: Size and retain the Security log

The default Security log size is small, and file auditing can overwrite old entries within hours on an active server. Increase it and decide on a retention method:

wevtutil sl Security /ms:1073741824
wevtutil gl Security

This sets a 1 GB maximum. Choose between overwriting as needed and archiving the log when it is full. For compliance needs, forward events to a central collector with Windows Event Forwarding or a SIEM so that a local administrator cannot simply clear the evidence. Clearing the Security log itself creates event 1102, which is worth alerting on.

Practical checklist

  • Enable auditing only for the folders that need it.
  • Prefer Write, Delete, Change permissions and Take ownership over Read.
  • Audit a group instead of Everyone when you only care about certain users.
  • Exclude temp and cache folders where applications write constantly.
  • Increase the Security log size and forward events off the server.
  • Test by creating and deleting a file, then confirm 4663 and 4660 appear.
  • Combine auditing with backups: auditing tells you who deleted a file, backups bring it back. Our Robocopy backups guide covers a simple setup.

FAQ

Why do I see no audit events after adding a SACL?

The audit policy is probably not enabled, or a Group Policy is overriding your local setting. Run auditpol /get /subcategory:"File System" and gpresult /r to confirm, then test again with a fresh file operation.

Does file auditing slow down the server?

Auditing a few folders for write and delete has a negligible effect. Auditing every read on a busy share across many users generates heavy log volume and some disk and CPU overhead, so keep the scope focused.

Can I see who read a file, not just who changed it?

Yes, enable "List folder / read data" in the auditing entry. Be aware that applications and antivirus software also read files, so expect many events and filter by user and process when you investigate.

Related guides