WMI 的非行话定义是什么?

发布于 2024-11-09 19:42:39 字数 342 浏览 0 评论 0原文

我已经阅读了一些有关 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

橘香 2024-11-16 19:42:39

概述

WMI 是一个允许查询有关计算机的信息的系统。 WMI 由许多不同的提供程序和类组成,每个类都可以有属性和方法,这与 .NET 没有太大不同。提供者有责任返还课程。

您可以在本地或远程查询 WMI。这就是为什么它被视为管理基础设施。 IT 人员可以使用 WMI 远程获取信息并使用 WMI 执行操作。例如,如果您想知道计算机上的驱动器类型,您可以运行如下 WQL 查询:

SELECT * FROM Win32_DiskDrive

这将返回 Win32_DiskDrive 并告诉您有关它的信息。因为它们是对象,所以它们也有方法。

有时,WMI 可以告诉您有关环境的信息,而您在其他地方无法获取该信息,例如使用 Win32_Mainboard 获取有关主板的信息时。

3rd 方开发人员可能会编写自己的 WMI 提供程序和类,以允许使用 WMI 管理他们的应用程序,这是 IT 人员可能已经熟悉的东西,他们不想重新发明轮子。

详细信息

提供程序是在 WMI 和管理对象/类之间起作用的 COM 对象。类在 MOF(托管对象格式)中定义。因此,底层的事情是提供程序被注册为该类的处理程序,并且当请求来自该类的信息时,提供程序被启动。与 .NET 一样,管理对象的作用域是在命名空间中定义的。 Microsoft 的大部分位于 \ROOT\cimv2 中。

提供者将实现接口IWbemProviderInitIWbemProviderInitSink此处有一些很好的详细信息,

因为它是一个 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:

SELECT * FROM Win32_DiskDrive

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 and IWbemProviderInitSink. There is some good details on that here

Since 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.

完美的未来在梦里 2024-11-16 19:42:39

我认为 technet 常见问题解答可能会有所帮助。

WMI中的“仪表”一词是指WMI可以获取有关计算机系统内部状态的信息,就像汽车的仪表板仪表可以检索和显示有关发动机状态的信息一样。 WMI 通过对磁盘、进程或 Windows 系统中的其他对象等对象进行建模来“检测”。这些计算机系统对象使用 Win32_LogicalDisk 或 Win32_Process 等类进行建模;正如您所期望的,Win32_LogicalDisk 类对计算机上安装的逻辑磁盘进行建模,Win32_Process 类对计算机上当前运行的任何进程进行建模。类基于称为公共信息模型 (CIM) 的可扩展模式。 CIM 架构是分布式管理任务组 (http://www.dmtf.org) 的公共标准。

它只是一种允许您获取系统信息的编程接口。 在这里你可以看一下它的架构,它可能会回答一些问题你的问题。

I think technet FAQ might be helpful a bit.

The word “Instrumentation” in WMI refers to the fact that WMI can get information about the internal state of computer systems, much like the dashboard instruments of cars can retrieve and display information about the state of the engine. WMI “instruments” by modeling objects such as disks, processes, or other objects found in Windows systems. These computer system objects are modeled using classes such as Win32_LogicalDisk or Win32_Process; as you might expect, the Win32_LogicalDisk class models the logical disks installed on a computer, and the Win32_Process class models any processes currently running on a computer. Classes are based on the extensible schema called the Common Information Model (CIM). The CIM schema is a public standard of the Distributed Management Task Force (http://www.dmtf.org).

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文