Developing Wmi Solutions

  • Authors:
  • Craig Tunstall;Gwyn Cole

  • Affiliations:
  • -;-

  • Venue:
  • Developing Wmi Solutions
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

From the Book: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 to virtually 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 don't harness the power of a systems management technology (like WMI); this is what drove us to write this book. We want developers to realize that making an application manageable is a key benefit, especially to system administrators. Once system administrators and IT support departments realize what can be done with WMI, they will start demanding that applications expose WMI management interfaces. Not only will system administrators be happy, but you'll be able to harvest a 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 systems functionality or configuration. We also want system administrators to realize what they can do in a system equipped with a technology like 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 systemadministrators understand Windows Management Instrumentation (WMI). WMI is a technology built into Windows which 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 SNMP (Simple Network Management Protocol) and DMI (Desktop Management Interface) 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 hardware and software relationships in an organisations network are equally important. The SNMP world only took systems management as far as the hardware, like routers. The DMI world only took systems management as far as the desktop. This led to the reasons why the Distributed Management Task Force (DMTF) defined a protocol/schema called WBEM (Web Based Enterprise Management). Microsoft adopted WBEM and WMI was born. WMI is an implementation of the WBEM standard and it is also 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 what Windows service packs 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 exploiting 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 needs to be instrumented. This means that hardware and software needs to expose its management interface through WMI. Hence, this book is important for developers to learn how to do this and it's important for administrators to learn how to exploit this technology which helps lower the TCO. This book is also important to software team leaders wishing to understand the impact of this new management model on development.How to approach this book and what you'll learnDevelopers and system administrators are the primary target audience for this book and will benefit from it in several ways. If you know nothing about systems management and/or WMI, don't worry. This book will take you from the beginning and develop your skills and knowledge in how to exploit WMI. We also intend for this book to be used as a reference. So if you want to develop a WMI provider in C++ to expose your software management interface, then you can go directly to Chapter 12. Likewise, if you want to get system management information in your .NET application, go to Chapter 8. Let's have a quick round up of each chapter.Chapter 1 - IntroductionThis chapter introduces the various concepts and terminology used in systems management, in particular, WMI. The spirit of the chapter highlights the necessity for a unified management standard like WBEM.Chapter 2 - Existing Management FrameworksThis 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 thoroughly introduced from an architectural perspective and provide you with an introduction to the basic principles and rationale behind systems management prior to WBEM. The chapter ends by summarizing those characteristics considered desirable in a management framework and how these relate to WBEM. Chapter 3 - Windows Management InstrumentationThis 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. There's some detailed information on the WMI architecture and the various interactions between WMI subsystems. Essential WMI vocabulary is introduced 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. This includes 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 RepositoryThe chapter continues to explain how to understand the various class schemas and the WMI tools provided by Microsoft. The class schemas describe virtually every aspect of a network, computer and its operating system together with the installed software. Included in this chapter is an in-depth tutorial that provides an extensive introduction to the skills you will need as either an administrator or developer when using the Common Information Model. The chapter also covers in detail how all the different WMI building blocks fit together. There's the introduction of namespaces, classes, properties, qualifiers, flavours and associations.Chapter 5 - Developing Class Schemas From a development point of view, the most important place to start in making your own software/hardware manageable through a standard management environment is learning how to develop a class schema. This is the first of two chapters that discusses how to do this. This chapter is also applicable to system administrators who wish to understand more about how to interpret a WMI class schema (perhaps for an administration script or perhaps simply to obtain information from a user's PC). The main thrust of the chapter is to introduce schema design by approaching a case study. It approaches this from a project lifecycle perspective. So all the stages of the class schema development/design are discussed and of course, there's lots of advice and tips along the way right through to deployment.Chapter 6 - Method design and schema class positioningContinuing from Chapter 5, this chapter focuses on how to interpret and approach subtle differences in schema design. Such as should you use a method to create a management object or use the WMI standard mechanism for doing this? There's advice about looking forward to future management requirements when designing your classes and how they should be positioned within the schema. There's also advice on localizing your schema and much more.Chapter 7 - Developing Management ApplicationsThis is the first of the development-oriented chapters. Accessing the WMI management environment can be achieved in a number of ways. However, this chapter is aimed primarily at developers who need to use C++ and COM to obtain and manipulate information in the management environment. There are many possibilities why you might want to do this, but here's an example. "You need access to the management environment so that you can develop a tool for managing your application's configuration, perhaps by developing a user interface administration console." The chapter contains useful and concise code samples to demonstrate how easy it is to use WMI. There's also discussion about event notification, security, accessing high-performance classes and much more.Chapter 8 - Developing .NET Management ApplicationsThis chapter is on a similar level to Chapter 7, except that it focuses on how use the classes in the .NET Framework using C#. The .NET Framework from Microsoft is effectively a new execution environment for applications. C# is a new programming language ultimately designed to leverage developer productivity. You'll see how easy the .NET Framework has made management applications development through the various code samples. Virtually every class in the .NET Framework is discussed in some detail. Chapter 9 - Developing MMC Snap-insThe Microsoft Management Console is Microsoft's answer to providing a consistent user interface where administrators can find all their management tools. The facility to have a similar look-and-feel in the administrative user interface and the fact that all administration tools can be found in one place, means that MMC helps administrators move towards a lower cost of ownership. This tutorial-style chapter follows the C++ & 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 being able to develop and extend other snap-ins to add your own administration facilities.Chapter 10 - Developing WMI Scripts for AdministratorsThis chapter is primarily aimed at the system administrator. The chapter (the first of two) assumes that you have very little experience with writing scripts (if at all) and therefore, starts at the beginning. The chapter starts by introducing the tools available for system administration and progresses to the VBScript boot camp. The boot camp introduces you to different types of problems you might experience and the techniques used to solve them. To enable you to get stuck in with the chapter's sample scripts, details on installing the Windows Scripting Host are covered. By the end of the chapter, you'll learn how to develop your own scripts that access and manipulate the management environment using WMI.Chapter 11 - WMI Scripting and WMICThis chapter builds on the lessons learned from Chapter 10. You learn from a systems management perspective (using a case study) how to break down administration problems and the scripting approach that you should use to solve them. Remote script execution is discussed as organisational networks contain a number of networked PCs. A new tool for the system administrator exists in Windows XP. It's called WMIC (Windows Management Instrumentation Command-line). WMIC is a command line tool that allows administrators to execute tasks and queries against the management environment. This chapter looks at WMIC in detail and provides you which a framework of quickly solving problems that WMIC would be good at. There's advice about how to debug scripts and more.Chapter 12 - Developing WMI ProvidersThis is a crucial chapter in the book which describes how software and hardware developers can write their own WMI providers. WMI providers are the gateway for developers to expose their own class schema. The chapter assumes that you have development skills in C++ & COM. There are many different types of provider's that can be developed and this chapter covers virtually all of them. The chapter starts by implementing a very simple fruit basket WMI instance provider and progresses to method, event, permanent event consumer, property and push providers. The knowledge gained from this chapter will form a solid grounding in developing WMI providers. Although not explicitly covered by the chapter, the source code accompanying the book contains a WMI provider ATL-like framework for accelerating your provider development.Chapter 13 - High Performance InstrumentationFinally, the book covers a very little-known subject of the WMI toolset called Event Tracing. Event Tracing is a very 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 on the website 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 different aspects of accessing WMI. So if you're not sure how to do something that's not explicitly covered by the chapters, check the sample projects. GlossaryNew terms and acronyms are introduced throughout the book. The glossary summarizes these at the end of the book.