Visual Basic.NET
  Home arrow Visual Basic.NET arrow WMI Programming with Visual Basic.NET: Man...
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

WMI Programming with Visual Basic.NET: Managing the OS
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2005-07-05

    Table of Contents:
  • WMI Programming with Visual Basic.NET: Managing the OS
  • Retrieving the list of all services
  • How to know the state of a service
  • How to modify (manage) the state of a service
  • How the above program works
  • How will I know the proper description of the error?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    WMI Programming with Visual Basic.NET: Managing the OS
    (Page 1 of 6 )

    In my previous article, part two of this series, we looked through some examples for accessing OS and hardware related information through WMI and VB.NET. In this article, we will look into managing the OS using WMI methods.
    You can download the zip of entire Visual Studio.NET solution (developed for this article) here.

    The first part of my series gives you the details for creating a Visual Studio.NET solution for WMI, right from the scratch. It will not be repeated any more in any of the future articles in this series.

    Can we operate (or manage) using WMI classes?

    In the previous parts of this series, I mostly concentrated on retrieving information (locally or remotely). Actually we didn’t operate (or manage) with that information. We just fetched and displayed the information on the form. 

    Certain classes of WMI provide some methods for operating on WMI objects. I should admit that we will not be able to do each and every operation that the WIN32 API does. But, mostly we can serve our needs just by using WMI (instead of complicating the situation with WIN32 API). 

    Since we now understand that we can manage the Windows operating system by using some of WMI objects, we need to know a bit about the theory of its implementation. All of my examples (in previous parts of this series) up to now worked only with certain properties of the respective WMI class. But, some of the WMI classes were already designed with certain methods to operate on the respective objects.  To invoke those methods programmatically, the class “ManagementObject” exposes a method called “InvokeMethod”.  Using this method, we can call any method of any WMI class (which has methods to execute) programmatically.

    Whenever a method gets executed dynamically (programmatically), we should certainly check, in general, for its result -- whether it executed successfully or not. When any WMI method gets executed through “InvokeMethod”, it returns an object of type “ManagementBaseObject”, which contains all of the parameters sent out -- in this case, return values or returned properties. We can know the status of the WMI method execution through this object easily by just fetching its properties (or return values). 

    I don’t want to discourage you with by focusing only on theory. The following sections will show you the practical implementation of the theory stated above.

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


     

    VISUAL BASIC.NET ARTICLES

    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...
    - Programmatically Controlling Windows Fax Ser...
    - Focusing on Forms and Menus in Visual Basic
    - Manipulating Forms with the Windows Forms Li...
    - Basics of the Windows Forms Library
    - Forms, Controls, and Other Useful Objects
    - Implementing OOP to Develop Database Oriente...
    - Using Themes and Skins for Personalization w...
    - A Deeper Look at Personalization using Visua...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway