Creating a Logical Consumer
A logical consumer is an instance of a permanent event consumer class. The main purpose of a logical consumer is to provide the physical consumer with the parameters for the activities the physical consumer performs. For more information, see Creating a New Permanent Event Consumer Class. The permanent consumer must have the same CreatorSID in the consumer, filter, and binding instances. For more information, see Receiving Events Securely. For an example of using a logical consumer, see Running a Script Based on an Event, which shows the use of the standard consumer class ActiveScriptEventConsumer to configure a permanent consumer.
The following procedure describes how to create a logical consumer.
To create a logical consumer
- Create an instance of your permanent consumer class.
- Fill the properties of the instance with the parameters of the action you want the physical consumer to perform.
The following MOF code example describes a logical consumer that contains a script.
#pragma namespace("\\\\.\\root\\subscription")
instance of ActiveScriptEventConsumer as $CONSUMER
{
Name = "MyConsumerName";
ScriptingEngine = "VBScript";
ScriptText =
"Set objFS = CreateObject(\"Scripting.FileSystemObject\")\n"
"Set objFile = objFS.OpenTextFile(\"C:\\\\ASEC.log\", 8, true);\n"
"objFile.WriteLine \"Time: \" + new Date() + \";\n"
"objFile.WriteLine \"Entry made by: \\\"ActiveScript\\\"\";\n"
"objFile.Close\n";
// this is the Administrators SID in array of bytes format
CreatorSID = {1,2,0,0,0,0,0,5,32,0,0,0,32,2,0,0};
};
After you create the logical consumer, you must then link each filter to an event filter to assign the action to a particular event. For more information, see Creating an Event Filter.