
Windows Management Instrumentation (WMI) - An IntroductionWindows Management
Instrumentation (WMI) is a component of the Windows Operating System that
is used to get information about your computer system or network. Using
Windows Management Instrumentation it is possible to create applications
that interact with your system and get the required information about
your system. The programming
interfaces provided by WMI are not limited to VBScript, C++, ODBC, Visual
Basic and HTML. WMI is very useful for system administrator since they
can use Windows Management Instrumentation to automate most of the administrative
tasks that they need to accomplish. Windows Management Instrumentation
can integrate with components to make the tasks much easier. The application
that is developed to retrieve information about the system will interact
with the WMI layer to get information. It is not necessary for the applications
to interact with the operating systems APIs since the APIs cannot retrieve
all the required information. There are limitations of the operating systems
APIs which are overcome by the WMI. As said earlier that application that
is created to get system information can be created using a variety of
languages to interact with the WMI such as Visual Basic, C++, and Active
X. The data that is retrieved by the WMI is stored using a model called
Common Information Model (CIM) which is a standard for storing information.
CIM is an
extensible, object oriented model which is used to store information about
the computer system. CIM can be used to create classes through the use
of WMI to represent different part of the computer system such as the
hard drives, routers, applications and other user defined components in
the network. It is easy to create an instance of a hard drive using the
CIM classes and make any changes to the instance which will be reflected
in the hard drive. CIM is a
language independent programming model. Associations and Schemas are used
in CIM model to relate different parts of the system and to create different
management environments. Object oriented techniques are used to represent
the different parts of the system such as the physical and the logical
drives in a computer system. As we know
the class can have properties and methods, the CIM model also uses the
properties and methods to describe the data and the behavior of the different
parts of the computer system or network. CIM is a language and platform
independent model. The Windows Management Instrumentation includes and
extension to CIM that describes the different Windows platforms. The CIM has
three different levels of classes called the Core, Common and the Extended
classes. The core classes represent all the areas of the management whereas
the Common classes represent the objects of specific areas which are the
extensions of the core classes. The extended classes as the name specifies
are the extensions to the common classes and they represent specific technologies
and apply to specific platforms such as Unix or Windows environments.
As we have
said earlier, Windows Management Instrumentation supports the concepts
of schemas. When we say schema, it is a group of classes that describes
a particular environment. Windows Management Instrumentation platform
SDK uses two schemas called the CIM and the Win32 schema. The schemas
that start with CIM_ are CIM schemas and the schemas that start with Win32_
are Win32 schemas. The core
classes and the common classes of the Common Information Model are found
in the CIM_ schema and the windows environment specific extended classes
are found in the Win32_ schema. It is possible to create your own schema
for any specific environment. You can create classes that describe the
environment you want and add them to the schema. But mostly the CIM and
the Win32 schemas are inherited for most of the requirements. The Managed
Object Format (MOF) language is used to create new CIM class. This is
the most common method of creating new CIM classes. Almost all the programming
languages of Microsoft are supported with methods to create and manipulate
CIM classes. A simple text editor can be used to describe new CIM classes
using the MOF. You can develop your own set of classes to describe an
application that you want to create. An MOF compiler
is used to compile the MOF file that is created in a text editor and creates
the CIM classes and adds them to the WMI repository. These CIM classes
that are created by you can be used by any administrator to perform the
required task. Operating systems like Windows 2000, Windows ME, and Windows
XP have MOF compiler as a part of the installation in the Windows Management
Instrumentation core. The Managed
Object Format language is used for describing the CIM classes. It is totally
different from the conventional languages such as C++ and other APIs.
It is very easy, human-readable, and reusable. It reduces the development
time required since the no of lines of code that are written are drastically
reduced by MOF language. Since this language is very easy to read it will
be easy to make any modifications in the future which will reduce the
cost of employing a person to make the changes. The MOF file
that is created can be shared by another application. Hence an MOF file
that is created for a particular environment can be reused by another
application and hence it reduces the cost of rewriting the MOF file again.
With MOF you can create a class, instance of the class, methods and also
insert MOF code in to WMI. Scripting
API for WMI can be used to develop quick applications to manage the environment.
Windows Script Host (WSH) scripts can access all the WMI classes for a
computer system. It is easy to create an application using scripts. Active
Directory objects can also be accessed using the ADSI scripts. Using scripting
you can do all the tasks that can be done using programming languages
such as C++ and C. Many simple examples are provided in the MSDN website
on the topic Scripting in WMI, which can be used to start
writing applications using Windows Management Instrumentation.
_______________________________________________________________________
FREE
Subscription
Subscribe to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________ Recommended
Resource |