我正在尝试注册此文件(mytest3.mof
):
#PRAGMA AUTORECOVER
#pragma namespace("\\\\.\\root\\subscription")
instance of __EventFilter as $EventFilter
{
Name = "Event Filter Instance Name";
EventNamespace = "Root\\Cimv2";
Query = "Select * From __InstanceCreationEvent Within 1 "
"Where TargetInstance Isa \"Cim_DirectoryContainsFile\" "
"and TargetInstance.GroupComponent=\"Win32_Directory.Name=\'C:\\\\test\'\"";
QueryLanguage = "WQL";
};
instance of ActiveScriptEventConsumer as $Consumer
{
Name = "TestConsumer";
ScriptingEngine = "VBScript";
ScriptFileName = "C:\\test\\test.vbs";
};
instance of __FilterToConsumerBinding
{
Filter = $EventFilter;
Consumer = $Consumer;
};
使用命令PS C:\windows\system32\wbem> mofcomp mytest3.mof
并接收此输出:
Microsoft (R) MOF Compiler Version 6.2.9200.16398
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: mytest3.mof
MOF file has been successfully parsed
Storing data in the repository...
WARNING: File mytest3.mof does not contain #PRAGMA AUTORECOVER.
If the WMI repository is rebuilt in the future, the contents of this MOF file w
ill not be included in the new WMI repository.
To include this MOF file when the WMI Repository is automatically reconstructed
, place the #PRAGMA AUTORECOVER statement on the first line of the MOF file.
Done!
这已经发生了几次,我可以看到该事件没有被注册。
有谁知道我为什么看到关于 的消息#PRAGMA AUTORECROVER
?Youc 清楚地看到该行已包含在文件中,但系统仍然抱怨它不存在...我不确定这是否是事件未注册的部分原因,但似乎它们可能是相关的。
作为一个可能有助于解释的额外细节 - 当我保存mytset3.mof
在wbem
文件夹中时,在我进入文件夹之前找不到该文件,创建一个新的空白文本文件并将其另存为mytest3.mof
. 在我这样做之前(即使我已经保存了文档),PC 的行为就像这个文件不存在一样......这里发生了什么?这可能与文件夹权限有关吗?