timhuang
Mon May 10 02:02:32 CDT 2004
Hello,
Based on my research, you can do that by view provider by creating the
appropriate mof. Save following text between the lines in a mof file say
a.mof and then run
mofcomp a.mof
Then connect to root\sample_views namespace and get instances of class
Join_NetAdapterAndConfig.
//----------------------mof content-----------------
#pragma namespace("\\\\.\\root\\sample_views")
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"};
};
[JoinOn("Win32_NetworkAdapter.index =
Win32_NetworkAdapterConfiguration.Index"),
ViewSources
{
"Select * from Win32_NetworkAdapter",
"Select * from Win32_NetworkAdapterConfiguration"
},
ViewSpaces
{
"\\\\.\\root\\cimv2",
"\\\\.\\root\\cimv2"
},
dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")]
class Join_NetAdapterAndConfig
{
[PropertySources{"AdapterType",""}]
string AdapterType;
[PropertySources{"Caption",""}]
string Caption;
[key,
PropertySources{"index","index"}]
uint32 ID;
[PropertySources{"","IPAddress"}]
string IPAddress[];
[PropertySources{"","MACAddress"}]
string MACAddress;
};
//----------------------end of-------------------------
Here's the link to learn more about view provider
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/view_provider.asp
Hope this helps.
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.