Tools / Event IDs / Event ID 5140

Event ID 5140: network share accessed

What Event ID 5140 (network share accessed) means, the fields to check, what is normal and what is suspicious, with PowerShell and KQL queries to find it.

Log: Security · Severity: Informational · MITRE ATT&CK T1021.002 · Updated 2026-11-03

Event ID 5140 is written when someone connects to a network share. It is logged once per session, not once per file, so it is far less noisy than file auditing. The share name tells most of the story: a user opening \\fileserver\Finance is business as usual, while a workstation connecting to C$ or ADMIN$ on another workstation usually is not.

The fields that matter

FieldWhat it tells you
Subject > Account NameThe account that connected.
Source AddressThe machine it connected from.
Share NameFor example \\*\IPC$, \\*\ADMIN$, \\*\C$, \\*\SYSVOL.
Share PathThe local folder behind the share.
Access MaskThe rights requested.

What is normal

SYSVOL and NETLOGON on domain controllers from every domain machine, IPC$ for many management tasks, and user file shares from users' own devices.

When Event ID 5140 is suspicious

Common false positive: Backup, inventory and deployment tools connect to admin shares on every machine. Their source addresses and service accounts belong on an allow list.

Find Event ID 5140 with PowerShell

Get-WinEvent -FilterHashtable @{LogName='Security'; Id=5140; StartTime=(Get-Date).AddDays(-7)} -MaxEvents 50 |
  ForEach-Object {
    $d = [ordered]@{ Time = $_.TimeCreated; Computer = $_.MachineName }
    ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }
    [pscustomobject]$d
  } | Format-List

Microsoft Sentinel (KQL)

SecurityEvent
| where TimeGenerated > ago(7d) and EventID == 5140
| project TimeGenerated, Computer, Account, Activity, EventData
| order by TimeGenerated desc

Related events

FAQ

How do I enable Event ID 5140?

Advanced Audit Policy > Object Access > Audit File Share, Success. Turn it on for servers first, where share access matters most.

What is the IPC$ share?

A special share for inter-process communication. Tools use it to talk to remote services over named pipes, which is why attackers and admins both touch it all the time.