尝试注册事件时无法分析的 MOF 查询
Unparsable MOF Query When Trying to Register Event
Update 2
我接受了答案,并在其他地方问了一个不同的问题,我仍在努力解决这个问题。
我不认为单行此查询是答案,因为我仍然没有得到所需的结果(并且在 .mof 中允许多行查询,如答案注释中的 URL 所示......
<小时 />更新
我按照建议将查询重写为单行代码,但仍然收到相同的错误!当它还在谈论第 11-19 行时,我知道一定还有另一个问题。保存带有更改的新文件后,我重新运行了mofcomp
,它似乎已加载,但是我订阅的事件根本不起作用。
真的觉得没有足够的关于这个主题的文档,很难弄清楚我打算如何调试它 - 任何这方面的帮助将不胜感激,即使这意味着使用不同的更合适的方法。
<小时 />我有以下.mof
文件,我想用它来在我的系统上注册事件:
#pragma namespace("\\.\root\subscription")
instance of __EventFilter as $EventFilter
{
Name = "Event Filter Instance Name";
Query = "Select * from __InstanceCreationEvent within 1 "
"where targetInstance isa "Cim_DirectoryContainsFile" "
"and targetInstance.GroupComponent = "Win32_Directory.Name="c:\\test""";
QueryLanguage = "WQL";
EventNamespace = "Root\Cimv2";
};
instance of ActiveScriptEventConsumer as $Consumer
{
Name = "TestConsumer";
ScriptingEngine = "VBScript";
ScriptText =
"Set objFSO = CreateObject("Scripting.FileSystemObject")n"
"Set objFile = objFSO.OpenTextFile("c:\test\Log.txt", 8, True)n"
"objFile.WriteLine Time & " " & " File Created"n"
"objFile.Closen";
// Specify any other relevant properties.
};
instance of __FilterToConsumerBinding
{
Filter = $EventFilter;
Consumer = $Consumer;
};
但是每当我运行命令mfcomp myfile.mof
时,我都会收到此错误:
解析 MOF 文件:myfile.mof
已成功解析 MOF 文件
正在存储库中存储数据...
处理文件 myfile.mof 中第 11 - 19 行定义的项目 1 时出错:
错误号: 0x80041058,设施: WMI
说明:无法分析的查询。
编译器返回错误0x80041058
此错误似乎是由查询中的语法不正确引起的,但我不明白我哪里出错了 - 有人可以建议吗?
在构建"查询"时没有使用字符串连接或行继续符。为简单起见,您可以将整个查询放在一行上。
相关文章:
- Mongodb c++驱动程序:如何查询元素的数组
- 查询SQLite数据库中的日期
- 如何在ArangoDb AQL查询中指定数据库
- Qt SQLite没有查询或参数计数不匹配
- 如何使用c++在VS 2019上运行SQL查询
- 从返回的顶点缓冲区查询顶点结构
- 以非特权用户身份查询 NTFS 特殊文件的元数据?
- C/C++ - 查询平台相关的换行符(用于内存映射文件)
- 查询 NFS 上的提升进程间::file_lock
- Qt JSON – 从子项查询
- 在 c++ 中解决段树以外的范围查询的有效方法是什么?
- 无法从 Win10 中的 IDirectDraw7 查询 IDirect3D7
- 如何查询以确定我的 MacOS/X 应用程序是否处于应用程序午睡模式?
- 在子数组中查找多个查询的不同(唯一)值的数量
- DNS 查询格式标头结构中的小字节序问题
- QSql查询行受影响的结果
- C++库相关查询
- 优化使用 C++ 查询 SQLite DB 中超过 5000 万条数据记录的方式
- MongoDB 使用数组中的 OR 条件构建查询
- 尝试注册事件时无法分析的 MOF 查询