Main example
List instances
# All instances of __EventFilter, with the main properties
Get-CimInstance -ClassName __EventFilter -Namespace 'root' |
Select-Object -Property Name, EventAccess, EventNamespace, QueryExamples
Filter with WQL
# WQL filter evaluated by the provider: names starting with "a" (the WQL wildcard is %)
$cimParameters = @{
ClassName = '__EventFilter'
Namespace = 'root'
Filter = "Name LIKE 'a%'"
}
Get-CimInstance @cimParameters |
Select-Object -Property Name, EventAccess, EventNamespace, QueryThe filter is evaluated by the WMI provider: less data is transferred than with Where-Object.
Query a remote computer (CIM session)
review before running# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
$cimParameters = @{
CimSession = $cimSession
ClassName = '__EventFilter'
Namespace = 'root'
}
Get-CimInstance @cimParameters |
Select-Object -Property Name, EventAccess, EventNamespace, Query
} finally {
Remove-CimSession -CimSession $cimSession
}WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.
Show the class structure
# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName __EventFilter -Namespace 'root'
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, FlagsProperties
| Name | Type | Access | Description |
|---|---|---|---|
| CreatorSID# | uint8[] | read/write | Security identifier (SID) that uniquely identifies the user who creates this filter. Windows Management Instrumentation (WMI) stores the SID of the user that creates an instance of __EventFilter or the Administrator SID, depending on the operating system. For more information, see Binding an Event Filter with a Logical Consumer and Monitoring and Responding to Events with Standard Consumers. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. |
| EventAccess# | string | read/write | Security descriptor (SD) in Security Descriptor Definition Language (SDDL) that controls access for events delivered to the filter. Use this property to specify that only events in the security context of specific accounts can be delivered to this filter. For example, a permanent event consumer may clear the security logs only when a specific event is generated by a specific user. To specify who can publish events to this filter, use the WBEM_RIGHT_PUBLISH mask in the Access Control Entry (ACE) for the SECURITY_DESCRIPTOR property. For more information, see Security Descriptor Definition Language. For more information about constants used to set this security descriptor, see WMI Security Constants. For more information and examples, see Receiving Events Securely. You can configure an event access security descriptor to allow an event to be delivered only when the local system account generates the event. For more information about creating security descriptor and authorizing access, see Access Control. Example: The following SDDL string allows only administrators to provide events to the filter. The right required to provide events is WBEM_RIGHT_PUBLISH (x80). ```VB O:BAG:BAD:(A;;0x80;;;BA) ``` CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. |
| EventNamespace# | string | read/write | Namespace of the event instance used for cross-namespace subscriptions. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. |
| Name# key | string | read/write | Unique identifier of an event filter. Because an event filter is only used internally by WMI, it is recommended that you set this property to a globally unique identifier (GUID) converted to a string. However, consumers can use any private scheme for a filter name as long as there is not a conflict with other filters. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. |
| Query# | string | read/write | Windows Management Instrumentation Query Language (WQL) event query that specifies the set of events for consumer notification, and the specific conditions for notification. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. |
| QueryLanguage# | string | read/write | Language used for the query. Because WMI currently supports only WMI Query Language (WQL) as a query language, this property must be set to "WQL". CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. |
Remarks
The __EventFilter class is derived from __IndicationRelated.
Inheritance
Superclass chain
- __SystemClass
- __IndicationRelated
- __EventFilter
Known subclasses
No known subclass.
Requirements
- Namespace
- root
- Minimum client
- Windows Vista
- Minimum server
- Windows Server 2008
- DLL
- All
Microsoft source
Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.