|
转一些windows管理的脚本入门 |
aku1 发表于 2005-4-27 11:00:07 |
从今天起,我将转些脚本文章
WMI Architecture
Microsoft® Windows® 2000 Scripting Guide
The first few pages of this chapter were designed to drive home one important point: WMI scripting does not have to be hard. In fact, WMI scripting can be very easy: As you have seen, you can take a basic script template and, by making only minor changes here and there, create hundreds of scripts that can retrieve information about any managed object on a computer.
All of this is true. However, it is also true that the opening section of this chapter sidestepped some important issues. For example, everyone appreciates the fact that WMI provides the Win32_NTLogEvent class, enabling you to retrieve events from event logs. However, how are you supposed to know that there is such a class as Win32_NTLogEvent? No one denies the value of having the Win32_Service class include properties such as Name, Description, and State, but how are you supposed to know these properties are included in the class? The fact that you can write hundreds of scripts using the same basic template is extremely useful, but only if you know what elements to plug in to that template.
In fact, in many respects scripting is the easy part of managing computers with WMI; the hard part involves figuring out what can and cannot be managed. The task-based chapters in this book can help you in that respect; if you want to manage files and folders, the "Files and Folders" chapter will provide detailed information about the appropriate WMI classes (and their methods and properties). But what if you want to manage video cards, desktop monitors, or network adapters? Although these items can be managed by using WMI, there is no handy reference to the appropriate classes (and their methods and properties) in this book.
Does this mean you can manage only the items referenced in this book? Of course not; in fact, you can manage anything WMI can manage, provided you understand how WMI works. After you understand how, and where, WMI stores information, you can easily determine the answer to such questions as 1) Which classes are available to me, 2) What are the names of these classes, and 3) Which properties and methods can be used with each class?
This section and the following section regarding the Common Information Model (CIM) provide in-depth coverage of the WMI architecture, starting you on your way toward a better understanding of this powerful administration tool. This section begins by examining the three primary layers of WMI (shown in Figure 6.1):
The section concludes by introducing the topic of WMI security. Although security is not an architectural layer like consumers, the WMI infrastructure, and managed resources, it is important to understand how WMI handles security before you begin writing and deploying scripts.
|
阅读全文 | 回复(0) | 引用通告 | 编辑 |
发表评论:
|