WMI 的非行话定义是什么?
我已经阅读了一些有关 WMI 的内容,并试图了解它是什么,但这一切似乎都有很多行话和循环定义。
此处:Windows 管理Instrumentation (WMI) 是基于 Windows 的操作系统上管理数据和操作的基础设施。
一个“基础设施”?啊?
它只是操作系统中用于访问系统资源、设备的一些挂钩吗?什么?如果是的话,它是由什么制成的?这些是 COM 类吗?
什么是 WMI?
I have been reading a bit about WMI, and trying to get a handle on what it is, but it all seems like a lot of jargon and circular definitions.
Here: Windows Management Instrumentation (WMI) is the infrastructure for management data and operations on Windows-based operating systems.
An "infrastructure"? Huh?
Is it just some hooks into the operating system for accessing system resources, devices? What? If so, what is it made of? Are these COM classes?
WHAT IS WMI?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
概述
WMI 是一个允许查询有关计算机的信息的系统。 WMI 由许多不同的提供程序和类组成,每个类都可以有属性和方法,这与 .NET 没有太大不同。提供者有责任返还课程。
您可以在本地或远程查询 WMI。这就是为什么它被视为管理基础设施。 IT 人员可以使用 WMI 远程获取信息并使用 WMI 执行操作。例如,如果您想知道计算机上的驱动器类型,您可以运行如下 WQL 查询:
这将返回 Win32_DiskDrive 并告诉您有关它的信息。因为它们是对象,所以它们也有方法。
有时,WMI 可以告诉您有关环境的信息,而您在其他地方无法获取该信息,例如使用 Win32_Mainboard 获取有关主板的信息时。
3rd 方开发人员可能会编写自己的 WMI 提供程序和类,以允许使用 WMI 管理他们的应用程序,这是 IT 人员可能已经熟悉的东西,他们不想重新发明轮子。
详细信息
提供程序是在 WMI 和管理对象/类之间起作用的 COM 对象。类在 MOF(托管对象格式)中定义。因此,底层的事情是提供程序被注册为该类的处理程序,并且当请求来自该类的信息时,提供程序被启动。与 .NET 一样,管理对象的作用域是在命名空间中定义的。 Microsoft 的大部分位于
\ROOT\cimv2
中。提供者将实现接口
IWbemProviderInit
和IWbemProviderInitSink
。 此处有一些很好的详细信息,因为它是一个 COM 对象,可以在 .NET 中编写 WMI 提供程序并使用 ComVisible 来公开该提供程序。
开发完成后,您需要注册。您还可以考虑在开发之前注册它以帮助调试。
Microsoft 在 http://msdn 中有一个简单的示例。 microsoft.com/en-us/library/aa393677(v=vs.85).aspx。
Overview
Well, WMI is a system that allows querying information about a machine. WMI is made up of many different providers and classes, and each class can have properties and methods on it, not so much unlike .NET. Providers are responsible from returning classes.
You can query WMI either locally, or remotely. That's why it's considered a management infrastructure. An IT staff can use WMI to get information and perform actions with WMI remotely. For example, if you wanted to know what kind of drives was on the machine, you could run a WQL query like this:
That would return a collection of Win32_DiskDrive and tell you information about it. Since they are objects, they have methods on them too.
Sometimes, WMI can tell you information about an environment that you can't get that information elsewhere, like when using Win32_Mainboard to get information about the motherboard.
3rd party developers might write their own WMI providers and classes to allow their application to be managed using WMI, something an IT person is likely already familiar with and they don't want to reinvent the wheel.
Details
A Provider is a COM Object that acts between WMI and a management object/class. Classes are defined in the MOF (Managed Object Format). So the underlying thing is a provider is registered as a handler for the class, and when information from that class is asked for, the provider is fired up. Like .NET, management objects are scoped and defined in namespaces. The bulk of Microsoft's are in
\ROOT\cimv2
.The provider will implement the interfaces
IWbemProviderInit
andIWbemProviderInitSink
. There is some good details on that hereSince it is a COM object, it is possible to write a WMI Provider in .NET and use
ComVisible
to expose the provider.Once you've developed it, you need to register it. You might also consider registering it before development it to aide debugging.
Microsoft has a simple example at http://msdn.microsoft.com/en-us/library/aa393677(v=vs.85).aspx.
我认为 technet 常见问题解答可能会有所帮助。
它只是一种允许您获取系统信息的编程接口。 在这里你可以看一下它的架构,它可能会回答一些问题你的问题。
I think technet FAQ might be helpful a bit.
It's just the kind of progrmming interface allowing you to get system info. Here you can take a look at it's architecture, it might answer some of your questions.