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, continued
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2005-07-12

    Table of Contents:
  • WMI Programming with Visual Basic.NET: Managing the OS, continued
  • 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, continued
    (Page 1 of 6 )

    In my previous article, part three of this series, we looked at some examples of 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 the 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 scratch.  It will not be repeated anymore in any of the future articles in this series.

    Can we operate (or manage) using WMI classes?

    In all of the previous parts of this series, I mostly concentrated on retrieving information (locally or remotely).  We didn’t operate (or manage) 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 WIN32 API does. But, mostly we can serve our needs just by using WMI (instead of complicating ourselves with WIN32 API). 

    Since we now understand that we can manage the Windows operating system using some WMI objects, we need to know a bit of theory about its implementation. All of my examples (in previous parts of this series) until now were working 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 executed successfully or not). When any WMI methods 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 fetching its properties (or return values). 

    I don’t want to discourage you with only 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...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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