Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The following Visual Basic Scripting Edition (VBScript) example illustrates how to retrieve an event notice indicating that a publishing point has been created.
Dim WithEvents eventSink As SWbemSink
Private Sub eventSink_OnObjectReady(ByVal obj As
WbemScripting.ISWbemObject, ByVal ctx As
WbemScripting.ISWbemNamedValueSet)
Dim Prop as SWbemPropertySet
Set Prop = obj.Properties_
Call MsgBox "Administrator " + Prop("Administrator").Value +_
"created publishing point ‘" +_
Prop("PublishingPointName").Value + "’ at " +_
Prop("Time")
End Sub
Private Sub Form_Load()
Set eventSink = New SWbemSink
Set Services = GetObject
("WINMGMTS:{impersonationLevel=impersonate}! _
\\.\Root\cimv2")
Services.ExecNotificationQueryAsync eventSink, "select * _
from WMS_Publishingpoint_Event Where SubEvent = ""Add"""
End Sub
The following example illustrates how to select only play events for content named Movie.wmv and display the name of the client and the IP address.
set events = GetObject
("winmgmts:{impersonationLevel=impersonate}! _
\\.\Root\cimv2"). _
ExecNotificationQuery ("select * from WMS_Client_Event _
where SubEvent = ""Play"" And Filename = ""Movie.wmv""")
do
set playevent = events.nextevent
if err <> 0 then
WScript.Echo Err.Number, Err.Description, Err.Source
Exit Do
else
WScript.Echo "Client at " + playevent.Properties_("ClientIP").value _
+ " asked to play " + playevent.Properties_("Title")
end if
loop