Re: Creating Permanent Mof in Windows 2000

From: Venus Millo (vm_at_spam.this.one)
Date: 03/22/04


Date: Sun, 21 Mar 2004 22:03:26 -0800

The EventNamespace property won't work on Win2000, because was only added in
XP.

For Win2000 you need to make some little extra effort:
- open %windir%\system32\wbem\scrcons.mof in notepad and remove the first
line - the one that says #pragma namespace (\\\\.\\root\default). Save.
- compile scrcons.mof in the root\cimv2 namespace. You can do this by
opening a cmd window and typying "mofcomp -n:root\cimv2
%windir%\system32\wbem\scrcons.mof"
- in your sample below change #pragma namespace from "root\\default" to
"root\\cimv2"
- also get rid of the EventNamespace property - it won't work on Win2000
- compile your sample.mof with mofcomp. It should work now.

What the article means for your case is that the ActiveScriptEventConsumer,
__EventFilter and __FilterToConsumerBinding instances have to be created in
the root\cimv2 namespace, because this is where Win32_Process class is.

Hope it helps,
Ven

"Harry S" <anonymous@discussions.microsoft.com> wrote in message
news:A0D17A61-D2AE-432C-A0D7-61F69E9E6871@microsoft.com...
> In the article Monitoring and Responding to Events with Standard
Consumers, it mentions that for Windows 2000 the event classes queried by
__EventFilter and the consumer class must be in the same namespace. What
does that really mean?
> The ActiveScriptEventConsumer is in Root\Default.
> The _EventFilter is in Root\CIMV2
> When I compiled my sample.mof below, I got the following error: "(Thu Mar
18 16:48:53 2004) : Unable to activate event filter with invalid query
'select * from __InstanceDeletionEvent where (TargetInstance ISA
"Win32_Process" AND TargetInstance.Name = "notepad.exe")' (error 80041002).
The filter is not active"
>
> Any hints or tips to solve this issue? Thanks.
> Harry
> --------------------------------------------------------------------------
---------
> ' sample.mof
>
> #pragma namespace ("\\\\.\\root\\default")
> instance of ActiveScriptEventConsumer as $Cons
> {
> Name = "ASEC";
> ScriptingEngine = "VBScript";
> ScriptFileName = "c:\\asec2.vbs";
> };
>
> instance of __EventFilter as $Filt
> {
> Name = "EF";
> Query = "SELECT * FROM __InstanceDeletionEvent WITHIN 5 "
> "WHERE TargetInstance ISA \"Win32_Process\" "
> "AND TargetInstance.Name = \"notepad.exe\"";
> QueryLanguage = "WQL";
> ' EventNamespace = "root\\default";
> };
>
> instance of __FilterToConsumerBinding
> {
> Filter = $Filt;
> Consumer = $Cons;
> };
> ---------------------------------------------------------------
>
> I
>
>