您的位置:首页 > 其它

使用MOF来扩展hardware inventory -- 动态数据 -- 补充2 -- 其它名称空间中的信息的收集

2010-04-08 14:42 281 查看
Client缺省只收集 CIMV2 名称空间中的WMI类实例的信息,对于其它名称空间中的信息,可以有两个方法来解决。

1. SMS 2003 高级客户端(SCCM2007 客户端也相同)支持从其它名称空间收集信息,但是在报告类中要加入标示符。例如下面的例子收集 root/WMI 名称空间中的 registeredGUIDs 类的实例信息,报告类中要指明名称空间信息。这里略去了数据类部分

#pragma namespace ("////.//root//CIMv2//sms")
[SMS_Report(TRUE),
SMS_Group_Name("Registered GUIDs"),
SMS_Class_ID("Microsoft|Registered GUIDs|1.0"),
Namespace("////////.////root////WMI")]
class RegisteredGuids : SMS_Class_Template
{
[SMS_Report(TRUE), key]
string InstanceName;
[SMS_Report(TRUE)]
boolean Active;
[SMS_Report(TRUE)]
uint32 GuidType;
[SMS_Report(TRUE)]
uint32 LoggerId;
[SMS_Report(TRUE)]
uint32 EnableLevel;
[SMS_Report(TRUE)]
uint32 EnableFlags;
[SMS_Report(TRUE)]
boolean IsEnabled;
};

2. 还有一种方式是通过 view provider来实现。view provider 是 WMI本身提供的provider,用于将其它名称空间的信息映射到CIMV2中。这原本是SMS 2003 legacy client使用的方式,但是也很实用。尤其是一些自带provider的程序本身就在WMI中创建了自己的名称空间并创建自己的类和实例,例如SQL Server,Exchange等。 SQL 2000 的provider在光盘上要手工安装,SQL2005以后是安装过程自行安装的。

#pragma namespace("////.//Root//CIMV2")
instance of __Win32Provider as $DataProv
{
Name = "MS_VIEW_INSTANCE_PROVIDER";
ClsId = "{AA70DDF4-E11C-11D1-ABB0-00C04FD9159E}";
ImpersonationLevel = 1;
PerUserInitialization = "True";
};
instance of __InstanceProviderRegistration

{
Provider = $DataProv;
SupportsPut = True;
SupportsGet = True;
SupportsDelete = True;
SupportsEnumeration = True;
QuerySupportLevels = {"WQL:UnarySelect"};
};
[union, ViewSources{"Select * from MSSQL_Database"},
ViewSpaces{"////.//root//MicrosoftSQLServer"}, Dynamic : ToInstance,
provider("MS_VIEW_INSTANCE_PROVIDER")]

-----------------------------------------------上面是实例化一个provider来映射MicrosoftSQLServer名称空间到CIMV2
class SQL_Databases
{
[PropertySources("Size") ] sint32 Size;
[PropertySources("SQLServerName"), key ] string SQLServerName;
[PropertySources("Name"), key ] string Name;
[PropertySources("SpaceAvailable") ] sint32 SpaceAvailable;
};

------------------------------------------------这段是数据类和数据类实例的定义

#pragma namespace("////.//root//CIMv2//sms")
[SMS_Report(TRUE),
SMS_Group_Name("SQL Database"),
SMS_Class_ID("MICROSOFT|SQLDatabase|1.0")]
class SQL_Databases : SMS_Class_Template
{
[SMS_Report(TRUE),key]
string SQLServerName;
[SMS_Report(TRUE),key]
string Name;
[SMS_Report(TRUE)]
sint32 Size;
[SMS_Report(TRUE)]
sint32 SpaceAvailable;
};
---------------------------------------------- 上面这段是报告类的定义
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐