__EventProviderRegistration

Event Provider Registration

Used to register event providers with Windows Management Instrumentation (WMI).

On this page

Main example

List instances

# All instances of __EventProviderRegistration, with the main properties
Get-CimInstance -ClassName __EventProviderRegistration -Namespace 'root' |
    Select-Object -Property EventQueryList, provider

Examples

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  = '__EventProviderRegistration'
        Namespace  = 'root'
    }
    Get-CimInstance @cimParameters |
        Select-Object -Property EventQueryList, provider
} 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 __EventProviderRegistration -Namespace 'root'
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

Properties

2 of 2 properties
NameTypeAccessDescription
EventQueryListstring[]read/write

One or more Windows Management Instrumentation Query Language (WQL) queries that describe the events that the event provider supports.

Code
# Value of EventQueryList for each instance
# EventQueryList is an array: -ExpandProperty returns its items one by one
$cimParameters = @{
    ClassName = '__EventProviderRegistration'
    Namespace = 'root'
    Property  = 'EventQueryList'
}
Get-CimInstance @cimParameters |
    Select-Object -ExpandProperty EventQueryList

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes EventQueryList on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName __EventProviderRegistration -Namespace 'root' |
    Select-Object -First 1
$setParameters = @{
    InputObject = $instance
    Property    = @{ EventQueryList = @('Example') }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
provider__Providerread

Object path to the event provider. This property is inherited from __ProviderRegistration.

Code
# Value of provider for each instance
$cimParameters = @{
    ClassName = '__EventProviderRegistration'
    Namespace = 'root'
    Property  = 'provider'
}
Get-CimInstance @cimParameters |
    Select-Object -Property provider

Remarks

Only administrators can register or delete an event provider by creating an instance of __Win32Provider and __EventProviderRegistration. The __EventProviderRegistration class is derived from __ProviderRegistration.

Inheritance

Superclass chain

  1. __SystemClass
  2. __ProviderRegistration
  3. __EventProviderRegistration

Known subclasses

No known subclass.

Requirements

Namespace
root
Minimum client
Windows Vista
Minimum server
Windows Server 2008
DLL
All

Microsoft source

Source: Microsoft Learn

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.