Developing WMI Solutions: A Guide to Windows Management Instrumentation

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $3.99
Usually ships in 1-2 business days
(Save 93%)
Other sellers (Paperback)
  • All (10) from $3.99   
  • New (5) from $35.94   
  • Used (5) from $3.99   

Overview

"Craig and Gwyn bring their insight and experience with WMI to explain how easy it is to write powerful management applications through WMI on the .NET platform."

—Andy Cheung, Microsoft WMI Test Engineer

Windows Management Instrumentation (WMI) is an impressive technology that provides, for the first time, an integrated approach to hardware and software management for the Windows operating system. Developing WMI Solutions gives administrators and developers the skills necessary to take advantage of the power of WMI with Windows 2000, XP, and .NET Server.

Developing WMI Solutions starts with an overview of the concepts behind systems management. The authors then provide a synopsis of existing management architectures, as well as an explanation of the architectural components of WMI and the tools provided by Microsoft for their use. Also included is a WMI scripting boot camp for administrators using samples in VBScript, plus a series of best practices that give scripts a professional edge.

You will find thorough coverage of such topics as:

  • The Common Information Model (CIM)
  • Developing CIM extended schemas
  • Management-application development using C++ and COM for WMI
  • MMC snap-in development using C++ and COM, presented as a tutorial
  • WMI providers and the necessary C++ and COM skills needed to expose class schema
  • Developing management applications using the .NET Framework—the first comprehensive guide to the WMI classes in the System.Management namespace

Finally, developers will learn about the often undersold but extremely powerful high-performance event-tracing mechanism available in Windows, which allows developers to expose detailed information about operations in an application.

The companion Web site, located at http://www.wbem.co.uk, includes the complete set of code examples found in the book, as well as updates and related articles.

Both a tutorial and a reference, Developing WMI Solutions is an essential companion for network administrators, software developers, and team leaders looking to become proficient with WMI.

0201616130B10072002

Read More Show Less

Product Details

Meet the Author

Craig Tunstall is a visiting lecturer and Ph.D. scholarship researcher at the University of Westminster in London, England. Prior to this, he was a senior Windows project leader in research and development at SDX Business Systems, a subsidiary of Lucent Technologies. Craig has been lecturing and doing research in the areas of WMI, network management, and distributed systems for the past three years.

Gwyn Cole is a senior software engineer with Avaya (formerly the Enterprise Networks Group of Lucent Technologies) working on Windows-based Unified Messaging products. Gwyn received his computer science degree from Staffordshire University in Stafford, England, and has worked in software development for seven years. His interests are in systems management and distributed computing, and he regularly speaks at software development forums.

0201616130AB10072002

Read More Show Less

Read an Excerpt

Windows Management Instrumentation (WMI) is an impressive technology. For the first time the Windows operating system employs a unified technology to represent software and hardware management. The power of WMI in systems management stretches virtually to every piece of software and hardware. So regardless of whether you're a team leader, software engineer, or system administrator, WMI will probably affect you.

Many applications written for Windows currently do not harness the power of a systems management technology such as WMI: This is why we wrote this book. We want developers to realize that making an application manageable is a key benefit, especially to system administrators. Once system administrators and Information Technology (IT) support departments realize what can be done with WMI, they will demand that applications expose WMI management interfaces. Not only will system administrators be happy, but you'll also be able to harvest the wealth of information available from WMI when building your own management applications. The other side of the coin, apart from making an application manageable, is a "management application." A management application is a program (like an MMC snap-in) or Web interface that can interact with the system to gather, inspect, and manipulate the system's functionality or configuration. We also want system administrators to realize what they can do in a system equipped with a technology such as WMI and how they should go about automating routine tasks.

We are both very excited about WMI and hope to spread the word to help the computing world become a more managed place.

Who Is This Book for and What Is WMI?

This book helps developers and system administrators understand Windows Management Instrumentation (WMI). WMI is a technology built into Windows that enables organizations to manage servers and user PCs connected to their networks. Systems management is becoming much more important as organizational networks become more complex. Systems management is not necessarily a new concept as existing protocols like Simple Network Management Protocol (SNMP) and Desktop Management Interface (DMI) have been around for a while. What is new is that it's been traditionally difficult to envisage a unified picture of the whole system.

Understanding the relationships between hardware and software in an organization's network is equally important. The SNMP world took systems management only as far as the hardware, such as routers. The DMI world took systems management only as far as the desktop. This led to the definition of Web Based Enterprise Management (WBEM), a protocol/schema, by the Distributed Management Task Force (DMTF). Microsoft adopted WBEM and WMI was born. WMI is an implementation of the WBEM standard that is consistent with Microsoft's Total Cost of Ownership (TCO) initiative. WMI brings the power of managing a Windows network to unprecedented levels. For example, through WMI a system administrator can easily write a script that will identify the Windows service packs that have been installed on all the machines in the network.

Administrators can easily develop scripts to perform routine tasks for their network, as well as exploit powerful notification facilities inherent within WMI to identify problems before their users experience them. For this level of system manageability to be made possible, the operating system, devices, and application software need to be instrumented—hardware and software need to expose their management interface through WMI. Hence, for developers, this book is important in learning how to do this; for administrators, it is important in learning how to exploit this technology that helps lower the TCO; and it is important to software team leaders in understanding the impact of this new management model on development.

How to Approach This Book and What You Will Learn

Developers and system administrators, the primary target audience for this book, will benefit from it in several ways. If you know nothing about systems management or WMI, don't worry—this book will help you develop your skills and knowledge of WMI from the beginning. We also intend for this book to be a reference, so if you want to develop a WMI provider in C++ to expose your software management interface, you can go directly to Chapter 12. Likewise, if you want to get system management information in your .NET application, you can go to Chapter 8. Let's have a quick round-up of each chapter.

Chapter 1: Introduction

This chapter introduces the various concepts and terminology used in systems management, in particular, WMI. The chapter highlights the necessity for a unified management standard such as WBEM.

Chapter 2: Existing Management Frameworks

This chapter aims to introduce the goals of WBEM and systems management by examining two existing management frameworks, SNMP and DMI. Still in widespread deployment, both are introduced thoroughly from an architectural perspective and provide an introduction to the basic principles and rationale behind systems management prior to WBEM. The chapter ends by summarizing the characteristics considered desirable in a management framework and how they relate to WBEM.

Chapter 3: Windows Management Instrumentation

This chapter covers a lot of ground to bring you up to speed with WMI. It covers installation and the various components that make up the WMI toolset. It contains some detailed information on the WMI architecture and the various interactions between WMI subsystems. It introduces essential WMI vocabulary so that you can understand the WMI features from a high-level perspective. The latter part of the chapter introduces some of WMI's powerful query language facilities, including queries for data (management information), queries for events (notification of activity), and queries against the class schema (understanding relationships between management information).

Chapter 4: A Guided Tour of the Common Information Model Repository

The chapter continues to help you understand the various class schemas and the WMI tools provided by Microsoft. The class schemas describe virtually every aspect of a network, a computer, and its operating system, as well as the installed software. The chapter includes an in-depth tutorial that provides an extensive introduction to the skills you will need as either an administrator or a developer using the Common Information Model (CIM). The chapter also covers in detail how all the WMI building blocks fit together. It introduces namespaces, classes, properties, qualifiers, flavors, and associations.

Chapter 5: Developing Class Schemas

From a development point of view, a class schema is the most important place to start to use a standard management environment to manage your own software and hardware. Chapter 5, the first of two chapters in which we discuss this, also is applicable to system administrators who wish to understand more about interpreting a WMI class schema (perhaps for an administration script or simply to obtain information from a user's PC). The chapter introduces schema design by approaching a case study from a project life-cycle perspective that discusses all the stages of the class schema development/design and offers lots of advice and tips along the way, right through to deployment.

Chapter 6: Method Design and Schema Class Positioning

Chapter 6 continues to develop the case study begun in Chapter 5, focusing on interpreting and approaching subtle differences in schema design, such as whether to use a particular method or the WMI standard mechanism to create a management object. It offers advice about looking toward future management requirements in designing classes and their positions within the schema, on localizing schema, and on a number of other topics.

Chapter 7: Developing Management Applications

Accessing the WMI management environment can be achieved in a number of ways. The first of the development-oriented chapters is aimed primarily at developers who need to use C++ and the Component Object Model (COM) to obtain and manipulate information in the management environment. Consider this example, one of the many reasons that you might want to do this: You need access to the management environment so that you can develop a tool, perhaps a user interface administration console, to manage your application's configuration. The chapter contains useful and concise code samples to demonstrate how easy it is to use WMI. It also discusses a number of topics, including event notification, security, and accessing high-performance classes.

Chapter 8: Developing .NET Management Applications

This chapter is on a similar level to Chapter 7, but focuses on how to use the classes in the .NET Framework using C#. The .NET Framework from Microsoft effectively is a new execution environment for applications. C# is a new programming language, ultimately designed to leverage developer productivity. Through the code samples, you'll see how easy the .NET Framework makes management applications development. Virtually every class in the .NET Framework is discussed in detail.

Chapter 9: Developing MMC Snap-ins

The Microsoft Management Console (MMC) is Microsoft's response to the need for a consistent user interface in which administrators can find all their management tools. The facility to have a similar look and feel across the administrative user interface and the fact that all administration tools can be found in one place mean that MMC helps administrators move toward a lower cost of ownership. This tutorial-style chapter follows the C++ and COM developer through each stage of MMC snap-in development. By the end of the chapter, you will see how to use WMI to access and manipulate Windows Services in a user interface designed for administration. One of MMC's most powerful features is the capability to develop and extend other snap-ins to add your own administration facilities.

Chapter 10: Developing WMI Scripts for Administrators

This chapter is the first of two aimed primarily at the system administrator. It assumes that you have very little, if any, experience in writing scripts and therefore starts at the beginning. It introduces the tools available for system administration and progresses to the VBScript boot camp. The boot camp introduces different types of problems you might experience and the techniques used to solve them. It gives detailed instructions for installing the Windows Scripting Host to enable you to use the chapter's sample scripts. By the end of the chapter, you'll learn how to develop your own scripts to use WMI to access and manipulate the management environment.

Chapter 11: WMI Scripting and WMIC

This chapter builds on the lessons learned from Chapter 10. From a systems management perspective (using a case study), you learn how to break down administration problems and solve them using the scripting approach. It discusses remote script execution, because organizational networks contain networked PCs. Windows Management Instrumentation Command-line (WMIC), a new command-line tool that allows administrators to execute tasks and queries against the management environment, exists in Windows XP. The chapter examines WMIC in detail and provides a framework that would be useful for solving problems quickly using WMIC. There's also advice on a number of topics, including how to debug scripts.

Chapter 12: Developing WMI Providers

This crucial chapter describes how software and hardware developers can write their own WMI providers, the gateway for developers to expose their own class schema. The chapter assumes that you have development skills in C++ and COM. It covers virtually all of the many types of providers that can be developed. The chapter implements a very simple fruit basket WMI instance provider in the beginning and progresses to method, event, permanent event consumer, property, and push providers. This chapter provides a solid grounding in developing WMI providers. The source code accompanying the book contains a WMI provider ATL-like framework for accelerating your provider development, although the chapter does not explicitly discuss it.

Chapter 13: High-Performance Instrumentation

Finally, the book covers event tracing, a very little-known subject of the WMI toolset. Event tracing is a powerful and high-performance method of instrumenting applications. It allows applications to expose very detailed information about an operation or task. The operating system uses this technology to expose activity in the Windows kernel, security subsystems, and numerous other subsystems.

Where Can I Find the Sample Source Code and Scripts?

All the source code and scripts can be found at http://www.wbem.co.uk/, the Web site that accompanies the book. This includes the MOF files, Visual C++ 6.0 projects, Visual Studio .NET projects, and the VB Scripts. The projects for the sample code from Chapters 7 and 8 contain many more short functions to demonstrate various aspects of accessing WMI. Check the sample projects if you're not sure how to do something that is not explicitly covered by the chapters.

Glossary

New terms and acronyms are introduced throughout the book. The glossary summarizes these at the end of the book.

Read More Show Less

Table of Contents

Preface.

1. Introduction.

Structure of the Book.

Pedagogical Elements.

Target Audience.

Prerequisites.

Terminology.

Software Requirements.

Operating System Requirements.

Hardware requirements.

Introducing WBEM.

WBEM's Basic Objectives.

Core Objectives.

The Central Information Store.

The Common Information Model.

Object Orientation and CIM.

Building an Information Model.

Structure of the Centralized Repository.

The Three-Tiered Model.

Acronyms and Terminology.

Standards Bodies.

Motivation.

De Facto and De Jure Standards.

The Distributed Management Task Force.

The World Wide Web Consortium.

Web-Based Enterprise Management.

Windows Management Instrumentation.

Common Information Model.

Common Information Model Repository.

Managed Object Format.

Simple Network Management Protocol.

Common Management Information Services.

Common Management Information Protocol.

Desktop Management Interface.

eXtensible Markup Language.

Hypertext Transfer Protocol.

Extended Schemas.

WMI Scripting.

Summary.

Ten Fast Facts: Web Based-Enterprise Management.

2. Existing Management Frameworks.

New and Old Technologies Combined.

The Need for a Universal Management Model.

The Simple Network Management Protocol.

A Simple Solution to a Complex Problem.

The SNMP Network Management Station.

Relevant SNMP Standards.

Structure of an SNMP Message.

Communities.

Event Notification-SNMP Traps and Informs.

The Management Information Base.

SNMP Security.

Modus Operandi.

Advantages of the SNMP Protocol.

Disadvantages of the SNMP Protocol.

The Desktop Management Interface.

The DMI Information Model: The Management Store.

Policy.

Notification of Events.

DMI Security.

MIF Database Security.

Management Interface Security.

Component Interface Security.

Security Indications.

Advantages of the DMI.

Disadvantages of the DMI.

Summary.

3. Windows Management Instrumentation.

The Standard WBEM Components.

Installing WMI.

Installation files.

Configuring Windows 98 for WMI.

Core Components of WMI.

WinMgmt.exe: The Windows Management Service.

mofcomp.exe: The Microsoft MOF Compiler.

The WMI Control.

Windows Management Instrumentation Tester.

Automatic MOF Registration.

WMI Log Files.

WMI CIM Repository.

Windows Management Instrumentation.

The Basic Framework of WMI.

WMI management applications.

Direct Access.

Indirect Access.

Providers.

Types of Providers.

Event Providers.

Data Providers.

Event Handling.

Intrinsic Events.

Extrinsic Events.

Timer Events.

Event Consumer.

Temporary Consumers.

Permanent Consumers.

WMI Security.

WMI Permission Assignment Using WMI Control.

The WMI Query Language.

Data Queries.

Event Queries.

Schema Queries.

Summary.

Ten Fast Facts: Windows Management Instrumentation.

4. A Guided Tour of the Common Information Model Repository.

Metadata.

Dynamic and Static Data.

Dynamic Data and the CIM Repository.

The Common Information Model.

The Core Model.

The Common Model.

The Extended Schemas.

Namespaces.

Using the CIMV2 Namespace.

WMI Namespaces and the CIM Repository.

Defining and Using Your Own Namespace.

Namespaces and Schemas.

Using Existing Schemas.

Subclassing and Instantiating Existing Classes in the CIMV2 Namespace.

Modifying Existing Classes.

Managed Object Format.

MOF Class Declaration.

Qualifiers.

Flavors.

Custom Qualifiers.

User-Defined Qualifiers.

Intrinsic Data Types.

Instance Creation.

Aliasing.

A Compileable MOF File.

ActiveX Components.

Let the Tour Begin!

The Class Explorer Explained.

Associations.

Key Propagation.

Namespaces and Associations.

System Properties.

Object and Property Qualifiers.

CIM Studio Functions.

Help for a Class.

Browse for a Namespace.

Search for a Class.

Instance Enumeration.

Change the View (System Properties and Inherited Properties).

WQL Queries Tool.

Add a Class.

Create an Association.

Delete a Class or Association.

Delete a Property.

Add an Instance.

Delete an Instance.

Places of Interest within the CIM Repository.

The Provider Classes.

The Namespace Classes.

Create a Namespace.

Delete a Namespace.

Tutorial: Creating a Namespace and Adding Classes, Properties, and an Association.

The Wizards.

The MOF Generator.

The MOF Compiler.

The Provider Code Generator.

Summary.

Ten Fast Facts: CIM Repository.

5. Developing Class Schemas.

Who is the chapter for?

Schema Design and System Manageability.

Case study: Client/Server Email Package.

Basic Functionality.

System Requirements for Post Office Email System.

The Unified Modeling Language.

Further Reading in UML.

Learning the CIM Schema and Win32 Extended Schemas.

Psychological Requirements.

Schema Design Timescales.

Software Application Life Cycle.

The Windows Installer and WMI.

The Role of WMI with Standard Software Applications and Management Software Applications.

Schema Design by Teams vs. Single Developers.

When Should I Commit My Design to UML?

Can I Design a Schema without UML?

The Unified Modeling Language in Schema Design.

A Brief Introduction to UML Object Modeling.

Interpreting the Common Model in UML.

The Schema Design Road Map.

Basic Rules for Schema Design.

WMI Topology Design.

First approach.

Second approach.

Schema Design Phase.

Step 1: Gather Information.

Step 2: Define System Requirements, Rules and Assertions.

Step 3: Define Classes and Properties.

Step 4: Define Associations.

Representing the PostOffice Schema in UML.

Conclusion.

Ten Fast Facts: Starting Schema Design Tips.

6. Method Design and Schema Class Positioning.

Properties vs. Methods.

Methods, Operations and Functions.

Step 5: Define Methods.

Candidate Methods.

Method Arguments.

Method Overriding and Polymorphism.

The Post Office Schema Methods.

Method AddUser.

Method RemoveUser.

Method UnlockAccount.

Method LockAccount.

Method StopPostOffice.

Method StartPostOffice.

PostOffice Schema UML Diagram with Methods.

Output.

Step 6: Check Schema Design.

Input.

Rule Generation-Based UML Diagrams.

Final Considerations—Future Additions.

Final Step: Positioning Classes.

Step-by-Step CIMV2 Namespace Class Positioning.

Extending the CIMV2 Namespace.

Normalization.

CIMV2 Class Placement Objectives.

Putting Class Placement Theory into Practice.

Namespace and Schema Placement.

The Applications Namespace.

Limitations of Multinamespace Class Positioning.

Post Office Schema Namespace Positioning.

The Post Office Schema Class Positions.

Managed Object Format (MOF) Qualifiers and Flavors.

MOF Creation and Testing.

Implementing the Schema: WMI API Calls vs. MOF code.

Multi-language support.

The Post Office Schema in MOF.

Compiling a Multilanguage MOF File.

Testing.

Schema Deployment.

Summary.

Schema Design and Positioning Q&A.

7. Developing Management Applications.

Getting Started.

Object Paths Explained.

Getting an Object.

Enumerating Objects.

Creating an Object.

First Point.

Second Point.

Third Point.

Example.

Updating Objects.

Deleting an Object.

Performing Queries.

Making Method Calls.

Manipulating Object Properties.

Manipulating Array Object Properties.

Accessing Objects from Object Properties.

Making Semisynchronous Calls.

Making Asynchronous Calls.

WMI Error Messages.

Overview of Events.

Intrinsic Events.

Extrinsic Events.

Timer Events.

How to Subscribe to Events.

Writing Applications to Receive Semisynchronous Events.

Writing Applications to Receive Asynchronous Events.

More on Security.

Classes that Require Specific Security Privileges.

Localized Namespaces.

Overview of High Performance Classes.

Writing Applications to Access High-Performance Data.

Access High-Performance Enumerated Data.

Summary.

Ten Fast Facts: Developing C++/COM Management Applications.

8. Developing .NET Management Applications.

Getting Started.

Getting a Management Object.

Enumerating Management Objects.

Creating a Management Object.

First Point.

Second Point.

Third Point.

Updating Management Objects.

Deleting a Management Object.

Performing Queries.

Making Method Calls.

Manipulating Management Object Properties.

Manipulating Array Object Properties.

Accessing Objects from Object Properties.

Making Asynchronous Calls.

Overview of Events.

Writing Applications to Receive Asynchronous Events.

Writing Applications to Receive Semisynchronous Events.

Managing Connections to WMI.

Summary.

Ten Fast Facts: Developing .NET Management Applications.

9. Developing MMC Snap-ins.

Snap-in Architecture.

Getting Started.

Snap-in Implementation Basics.

Let's Make a Snap-in.

Implementing IComponentData.

Implementing IComponent.

The Root Item and General Item Basics.

Adding Your Own Namespace Items.

Adding Your Own Columns.

Adding Your Own Result Items.

Setting Up and Handling Verbs.

Adding Your Own Menus.

Adding Your Own Toolbars.

Adding Your Own Property Pages.

Refocusing an Item's Property Sheet.

Adding Your Own Help.

Primary (Standalone) Snap-in Registration.

More on How ATL Delegates Tasks to an Item.

Renaming Items.

Drag and Drop.

Accessing Web Sites.

Displaying Custom Views.

Developing Extension Snap-ins.

Exchanging Information between Primary and Extension Snap-ins.

Extension Snap-in Registration.

Making MMC Snap-ins Theme Aware.

Summary.

Ten Fast Facts: Developing MMC Snap-ins.

10. Developing WMI Scripts for Administrators.

Scripting, WMIC and the CIM Studio.

Administration and the WMI CIM Studio.

Administration and the WMIC.

Administration and Scripting.

Guiding Principles.

Prerequisites.

Chapter Structure.

VBScript Boot Camp.

JavaScript vs. VBScript.

Setting Up Your System for Scripting.

Scripting and Administration.

What Is the Windows Scripting Host?.

Scripts.

Scripting vs. Compiled Languages.

The Windows Scripting Host.

Your First Script.

Indentation.

Annotation.

Variants, Variables and Constants.

Use Meaningful Variable Names.

VBScript Functions.

The WSH Object Model.

Program Statements and Keywords.

The Option Explicit Statement.

Connecting to a Local or Remote Namespace.

Security Issues.

Deciding on the Level of Security Required.

Data Input.

Error Detection.

Error Logging (NT/2000/XP Only).

WMI Scripting Data Retrieval.

Displaying Date and Time Values (XP only).

Retrieving Subsets of Instances.

WMI Data Modification Scripting Example.

Data Deletion Scripting Example.

Data Creation Scripting Example.

Association Traversal Using VBScript.

Executing Methods Using VBScript.

Summary.

Ten Fast Facts: Summary of VBScript boot camp.

11. WMI Scripting and WMIC.

Identifying the Correct Course of Action.

Make a Note of the Problem Description.

Divide the Problem into Its Constituent Parts.

Decide Which Hardware or Software Components You Are Going to Manage.

Which tool?

Decide Whether Your Script Should Run Locally or Remotely on the Target Machines.

Decide Whether Your Script Will Run Unattended or Attended.

Determine the Variables and Constants.

Candidate Constants.

Candidate Variables.

Determine the Sequence of Steps in the Task.

Script Deployment and Execution.

Local Execution and Storage.

Local Execution from a Shared Resource.

Remote Connection across a Network.

Remote Invocation of a Script (Available Only with Windows Script v5.6).

Script Execution Methods.

Executing Scripts at Start Up.

Execute the Script Using the Windows Scheduler.

Event-driven Script Execution (Windows XP Only).

Sending E-mail.

Setting Up Your System for Debugging and Testing.

Debugging Your Scripts.

Windows Management Instrumentation Command-line (WMIC).

Using WMIC.

Interactive Mode.

Configuring WMIC.

Interacting with WMIC.

The WHERE Clause.

Verbs.

Adverbs.

Looping WMIC Commands.

Types of Output.

Aliases.

Creating or Modifying Aliases Using the CIM Studio.

Using WMIC in Non-Interactive Mode.

Summary.

Ten Fast Facts: WMIC Tips.

12. Developing WMI Providers.

Where to Start.

Developing an Instance Provider.

Provider Registration.

Provider Initialization.

Enumerating Objects.

Getting an Object.

Deleting an Object.

Creating or Updating an Object.

Querying for Your Objects.

Instance Provider Registration.

Developing a Method Provider.

Executing Methods.

Method Provider Registration.

Developing an Event Provider.

Firing Events.

Event Provider Registration.

Developing an Event Consumer Provider.

Handling Event Notifications.

Permanent Event Consumer Provider Registration.

Developing a Property Provider.

Exposing Dynamic Properties.

Property Provider Registration.

Developing a Push Provider.

Pushing Data to the CIM Repository.

Push Provider Registration.

Security Considerations.

Summary.

Ten Fast Facts: Developing WMI Providers.

13. High Performance Instrumentation.

Overview of Event Tracing.

Controlling Event Traces.

Starting a Kernel Event-Tracing Session.

Setting Up a Session's Configuration.

Querying the Session's Configuration and Statistics.

Stopping the Session.

Starting Event-Tracing Sessions.

Querying for Active Event-Tracing Sessions.

Querying for Registered Event-Tracing Providers.

Starting Private Event-Tracing Sessions.

Developing an Event-Tracing Provider.

Defining the Event Class Schema.

Registering an Application as an Event-Tracing Provider.

Developing the Provider's Control Call-Back Function.

Producing an Event Trace.

Producing a Hierarchical Event Trace.

Analyzing Event-Trace Log Files.

Processing an Event-Trace Log File.

The Event Call-Back Function.

The Buffer Call-Back Function.

The Consumer Event-Tracing APIs.

Monitoring Real-Time Event-Tracing Sessions.

Providing and Analyzing Lightweight Events.

Analyzing lightweight events.

Summary.

Ten Fast Facts: High Performance Instrumentation.

Appendix A.

Appendix B.

Glossary.

Bibliography.

Index. 0201616130T10172002

Read More Show Less

Preface

Windows Management Instrumentation (WMI) is an impressive technology. For the first time the Windows operating system employs a unified technology to represent software and hardware management. The power of WMI in systems management stretches virtually to every piece of software and hardware. So regardless of whether you're a team leader, software engineer, or system administrator, WMI will probably affect you.

Many applications written for Windows currently do not harness the power of a systems management technology such as WMI: This is why we wrote this book. We want developers to realize that making an application manageable is a key benefit, especially to system administrators. Once system administrators and Information Technology (IT) support departments realize what can be done with WMI, they will demand that applications expose WMI management interfaces. Not only will system administrators be happy, but you'll also be able to harvest the wealth of information available from WMI when building your own management applications. The other side of the coin, apart from making an application manageable, is a "management application." A management application is a program (like an MMC snap-in) or Web interface that can interact with the system to gather, inspect, and manipulate the system's functionality or configuration. We also want system administrators to realize what they can do in a system equipped with a technology such as WMI and how they should go about automating routine tasks.

We are both very excited about WMI and hope to spread the word to help the computing world become a more managed place.

Who Is This Book for and What Is WMI?

This book helps developers and system administrators understand Windows Management Instrumentation (WMI). WMI is a technology built into Windows that enables organizations to manage servers and user PCs connected to their networks. Systems management is becoming much more important as organizational networks become more complex. Systems management is not necessarily a new concept as existing protocols like Simple Network Management Protocol (SNMP) and Desktop Management Interface (DMI) have been around for a while. What is new is that it's been traditionally difficult to envisage a unified picture of the whole system.

Understanding the relationships between hardware and software in an organization's network is equally important. The SNMP world took systems management only as far as the hardware, such as routers. The DMI world took systems management only as far as the desktop. This led to the definition of Web Based Enterprise Management (WBEM), a protocol/schema, by the Distributed Management Task Force (DMTF). Microsoft adopted WBEM and WMI was born. WMI is an implementation of the WBEM standard that is consistent with Microsoft's Total Cost of Ownership (TCO) initiative. WMI brings the power of managing a Windows network to unprecedented levels. For example, through WMI a system administrator can easily write a script that will identify the Windows service packs that have been installed on all the machines in the network.

Administrators can easily develop scripts to perform routine tasks for their network, as well as exploit powerful notification facilities inherent within WMI to identify problems before their users experience them. For this level of system manageability to be made possible, the operating system, devices, and application software need to be instrumented--hardware and software need to expose their management interface through WMI. Hence, for developers, this book is important in learning how to do this; for administrators, it is important in learning how to exploit this technology that helps lower the TCO; and it is important to software team leaders in understanding the impact of this new management model on development.

How to Approach This Book and What You Will Learn

Developers and system administrators, the primary target audience for this book, will benefit from it in several ways. If you know nothing about systems management or WMI, don't worry--this book will help you develop your skills and knowledge of WMI from the beginning. We also intend for this book to be a reference, so if you want to develop a WMI provider in C++ to expose your software management interface, you can go directly to Chapter 12. Likewise, if you want to get system management information in your .NET application, you can go to Chapter 8. Let's have a quick round-up of each chapter.

Chapter 1: Introduction

This chapter introduces the various concepts and terminology used in systems management, in particular, WMI. The chapter highlights the necessity for a unified management standard such as WBEM.

Chapter 2: Existing Management Frameworks

This chapter aims to introduce the goals of WBEM and systems management by examining two existing management frameworks, SNMP and DMI. Still in widespread deployment, both are introduced thoroughly from an architectural perspective and provide an introduction to the basic principles and rationale behind systems management prior to WBEM. The chapter ends by summarizing the characteristics considered desirable in a management framework and how they relate to WBEM.

Chapter 3: Windows Management Instrumentation

This chapter covers a lot of ground to bring you up to speed with WMI. It covers installation and the various components that make up the WMI toolset. It contains some detailed information on the WMI architecture and the various interactions between WMI subsystems. It introduces essential WMI vocabulary so that you can understand the WMI features from a high-level perspective. The latter part of the chapter introduces some of WMI's powerful query language facilities, including queries for data (management information), queries for events (notification of activity), and queries against the class schema (understanding relationships between management information).

Chapter 4: A Guided Tour of the Common Information Model Repository

The chapter continues to help you understand the various class schemas and the WMI tools provided by Microsoft. The class schemas describe virtually every aspect of a network, a computer, and its operating system, as well as the installed software. The chapter includes an in-depth tutorial that provides an extensive introduction to the skills you will need as either an administrator or a developer using the Common Information Model (CIM). The chapter also covers in detail how all the WMI building blocks fit together. It introduces namespaces, classes, properties, qualifiers, flavors, and associations.

Chapter 5: Developing Class Schemas

From a development point of view, a class schema is the most important place to start to use a standard management environment to manage your own software and hardware. Chapter 5, the first of two chapters in which we discuss this, also is applicable to system administrators who wish to understand more about interpreting a WMI class schema (perhaps for an administration script or simply to obtain information from a user's PC). The chapter introduces schema design by approaching a case study from a project life-cycle perspective that discusses all the stages of the class schema development/design and offers lots of advice and tips along the way, right through to deployment.

Chapter 6: Method Design and Schema Class Positioning

Chapter 6 continues to develop the case study begun in Chapter 5, focusing on interpreting and approaching subtle differences in schema design, such as whether to use a particular method or the WMI standard mechanism to create a management object. It offers advice about looking toward future management requirements in designing classes and their positions within the schema, on localizing schema, and on a number of other topics.

Chapter 7: Developing Management Applications

Accessing the WMI management environment can be achieved in a number of ways. The first of the development-oriented chapters is aimed primarily at developers who need to use C++ and the Component Object Model (COM) to obtain and manipulate information in the management environment. Consider this example, one of the many reasons that you might want to do this: You need access to the management environment so that you can develop a tool, perhaps a user interface administration console, to manage your application's configuration. The chapter contains useful and concise code samples to demonstrate how easy it is to use WMI. It also discusses a number of topics, including event notification, security, and accessing high-performance classes.

Chapter 8: Developing .NET Management Applications

This chapter is on a similar level to Chapter 7, but focuses on how to use the classes in the .NET Framework using C#. The .NET Framework from Microsoft effectively is a new execution environment for applications. C# is a new programming language, ultimately designed to leverage developer productivity. Through the code samples, you'll see how easy the .NET Framework makes management applications development. Virtually every class in the .NET Framework is discussed in detail.

Chapter 9: Developing MMC Snap-ins

The Microsoft Management Console (MMC) is Microsoft's response to the need for a consistent user interface in which administrators can find all their management tools. The facility to have a similar look and feel across the administrative user interface and the fact that all administration tools can be found in one place mean that MMC helps administrators move toward a lower cost of ownership. This tutorial-style chapter follows the C++ and COM developer through each stage of MMC snap-in development. By the end of the chapter, you will see how to use WMI to access and manipulate Windows Services in a user interface designed for administration. One of MMC's most powerful features is the capability to develop and extend other snap-ins to add your own administration facilities.

Chapter 10: Developing WMI Scripts for Administrators

This chapter is the first of two aimed primarily at the system administrator. It assumes that you have very little, if any, experience in writing scripts and therefore starts at the beginning. It introduces the tools available for system administration and progresses to the VBScript boot camp. The boot camp introduces different types of problems you might experience and the techniques used to solve them. It gives detailed instructions for installing the Windows Scripting Host to enable you to use the chapter's sample scripts. By the end of the chapter, you'll learn how to develop your own scripts to use WMI to access and manipulate the management environment.

Chapter 11: WMI Scripting and WMIC

This chapter builds on the lessons learned from Chapter 10. From a systems management perspective (using a case study), you learn how to break down administration problems and solve them using the scripting approach. It discusses remote script execution, because organizational networks contain networked PCs. Windows Management Instrumentation Command-line (WMIC), a new command-line tool that allows administrators to execute tasks and queries against the management environment, exists in Windows XP. The chapter examines WMIC in detail and provides a framework that would be useful for solving problems quickly using WMIC. There's also advice on a number of topics, including how to debug scripts.

Chapter 12: Developing WMI Providers

This crucial chapter describes how software and hardware developers can write their own WMI providers, the gateway for developers to expose their own class schema. The chapter assumes that you have development skills in C++ and COM. It covers virtually all of the many types of providers that can be developed. The chapter implements a very simple fruit basket WMI instance provider in the beginning and progresses to method, event, permanent event consumer, property, and push providers. This chapter provides a solid grounding in developing WMI providers. The source code accompanying the book contains a WMI provider ATL-like framework for accelerating your provider development, although the chapter does not explicitly discuss it.

Chapter 13: High-Performance Instrumentation

Finally, the book covers event tracing, a very little-known subject of the WMI toolset. Event tracing is a powerful and high-performance method of instrumenting applications. It allows applications to expose very detailed information about an operation or task. The operating system uses this technology to expose activity in the Windows kernel, security subsystems, and numerous other subsystems.

Where Can I Find the Sample Source Code and Scripts?

All the source code and scripts can be found at http://www.wbem.co.uk/, the Web site that accompanies the book. This includes the MOF files, Visual C++ 6.0 projects, Visual Studio .NET projects, and the VB Scripts. The projects for the sample code from Chapters 7 and 8 contain many more short functions to demonstrate various aspects of accessing WMI. Check the sample projects if you're not sure how to do something that is not explicitly covered by the chapters.

Glossary

New terms and acronyms are introduced throughout the book. The glossary summarizes these at the end of the book.

0201616130P10172002

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted January 4, 2003

    At last! Something for overworked sysadmins

    A significant component of the Total Cost of Ownership of a network of personal computers is due to the myriad different pieces of hardware and software that these can contain; invariably from a slew of vendors. Integrating and managing the totality can be quite labour intensive for the systems administrator. Also too for the developer; whether she is writing the interface for a piece of software that others will use or if she is on the other side, and has to write code that runs that package and others. Accordingly, Microsoft has pushed forward Windows Management Instrumentation. The book describes how to use WMI straightforwardly. You do need to know C++, COM and Active Template Library. No surprise there. Several sections also describe using the still new C# and .NET to write OO applications that easily connect to WMI. If you have not used C# and .NET, the book's coverage is concise enough to get you started. The authors treat a minimal subset that is enough for you to do useful work vis-a-vis WMI. On the scripting aspect, the authors rightly give this careful coverage. Scripting files may not have the sexy appeal of a GUI-driven methodology. But in fact, for automated systems administration of many machines, they are usually far more important. Veterans of DOS and Unix batch file writing will see much of familiar approaches here. Part of Microsoft's incentive for promoting WMI is to help it stay ahead of linux. The basic functionality of a browser and Microsoft Office are already in various linux applications. So at least in the network sphere, WMI helps Microsoft hold off linux. The authors do not discuss this, but if you read this book, you should keep it in mind; in the broader context of where the PC market is going.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)