SWbemEventSource 개체

SWbemEventSource 개체는 SWbemServices.ExecNotificationQuery와 함께 이벤트 쿼리에서 이벤트를 검색합니다. SWbemServices.ExecNotificationQuery를 호출하여 이벤트 쿼리를 만드는 경우 SWbemEventSource 개체를 가져옵니다. 그런 다음 NextEvent 메서드를 사용하여 도착하는 이벤트를 검색할 수 있습니다. 이 개체는 VBScript CreateObject 호출로 만들 수 없습니다.

멤버

SWbemEventSource 개체에는 다음과 같은 형식의 멤버가 있습니다.

메서드

SWbemEventSource 개체에는 다음과 같은 메서드가 있습니다.

메서드 설명
NextEvent SWbemServices.ExecNotificationQuery와 함께 이벤트를 검색하는 데 사용됩니다.

속성

SWbemEventSource 개체에는 다음과 같은 속성이 있습니다.

속성 액세스 유형 설명
Security_
읽기 전용
보안 설정을 읽거나 변경하는 데 사용됩니다.

예제

이 스크립트는 애플리케이션 이벤트에 대한 WQL 쿼리와 함께 SWbemEventSource 클래스 및 SWbemServices 클래스의 메서드를 사용합니다. WMI 이벤트 알림 및 쿼리에 대한 자세한 내용은 이벤트 모니터링, 이벤트를 기반으로 스크립트 실행비동기 이벤트 알림 수신을 참조하세요.

' Connect to WMI, obtaining an SWbemServices object
set svc = _
CreateObject("Wbemscripting.SWbemLocator")._
   ConnectServer(,"root\cimv2")

' Obtain an SWbemEventSource object from the 
' SWbemServices.ExecNotificationQuery method to specify the 
' event source as "Application" events in a Win32_NTLogEvent
set evtsrc = svc.ExecNotificationQuery("SELECT * " _
   & "FROM __InstanceCreationEvent " _
   & "WHERE TargetInstance ISA 'Win32_NTLogEvent'" _
   & "AND TargetInstance.Logfile ='Application'")

' Wait for an event by executing the NextEvent method on the 
' SWbemEventSource object.
while (num < 5)
    set inst = evtsrc.NextEvent(-1)
    Wscript.echo inst.TargetInstance.Logfile
    num = num + 1
wend

요구 사항

요구 사항
지원되는 최소 클라이언트
Windows Vista
지원되는 최소 서버
Windows Server 2008
헤더
Wbemdisp.h
유형 라이브러리
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemEventSource
IID
IID_ISWbemEventSource

추가 정보

스크립팅 API 개체