PowerShell Suspicious Discovery Related Windows API Functionsedit

This rule detects the use of discovery-related Windows API Functions in Powershell Scripts. Attackers can use these functions to perform various situational awareness related activities, like enumerating users, shares, sessions, domain trusts, groups, etc.,

Rule type: query

Rule indices:

  • winlogbeat-*
  • logs-windows.*

Severity: medium

Risk score: 47

Runs every: 5 minutes

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100



  • Elastic
  • Host
  • Windows
  • Threat Detection
  • Discovery

Version: 1

Added (Elastic Stack release): 7.16.0

Rule authors: Elastic

Rule license: Elastic License v2

Potential false positivesedit

Legitimate Powershell Scripts that make use of these Functions

Rule queryedit

event.code:"4104" and powershell.file.script_block_text : (
NetShareEnum or NetWkstaUserEnum or NetSessionEnum or
NetLocalGroupEnum or NetLocalGroupGetMembers or DsGetSiteName
or DsEnumerateDomainTrusts or WTSEnumerateSessionsEx or
WTSQuerySessionInformation or LsaGetLogonSessionData or
QueryServiceObjectSecurity )

Threat mappingedit