SunQuest
 
       Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 3 - WMI Programming with Visual Basic.NET: Wha...
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 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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: What is the WQL?
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2005-06-28

    Table of Contents:
  • WMI Programming with Visual Basic.NET: What is the WQL?
  • Querying WMI with WQL (remote environment)
  • Types of WQL queries
  • Working with WQL Schema queries

  • 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
     
     
    ADVERTISEMENT

    Ajax Application Generator Generate database 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: What is the WQL? - Types of WQL queries


    (Page 3 of 4 )

    The previous sections just demonstrated some simple examples of WQL.  Actually WQL has its own classification of queries. They are as follows:

    • Data Queries

    • Event Queries

    • Schema Queries

    Every WMI class instance represents a physically existing resource residing at your computer or on the network or at any location. Any physical resource (or instance) would definitely fall into a category of a particular WMI class, where we can query all those instances through WQL.

    Data queries are used to retrieve WMI class instances and data associations. They are the most commonly used type of query in WMI scripts and applications. All the examples in the previous sections are of the Data query type (as we are trying to retrieve the instances of WMI class ‘Win32_LogicalDisk’).

    Every programmer knows that the entire Windows operating system is event-driven. Anything you operate with Windows OS is an event.  Examples of events include logging in, logging out, printing a page, installing software, opening an application, connecting to a network, and so forth. Now, say I wanted to have some script executed when someone logs in. That means my script should register to the “login” (for example) event, and continuously listen for that event to occur. When the event occurs, my script gets executed. 

    These kinds of scripts (listening for events of WMI) are called consumers. Consumers use event queries to register and receive notification of events. Event providers use event queries to register one or more events. In general, the queries used for trapping event notifications are called “event queries” (which will be discussed in my upcoming articles).

    How do you list all of the namespaces available?  How many sub-namespaces does each of the main namespaces contain? What are the classes owned by a particular namespace? How do you get this type of information (programmatically)? For all of the previous questions, “schema queries” is the answer. Schema queries are used to retrieve class definitions (rather than class instances) and schema associations. Schema queries use the SELECT statement with syntax similar to that for data queries. The difference is the use of a special class called “meta_class”, which identifies the query as a schema query. Schema queries only support "*" in the SELECT statement. To narrow the scope of the definitions returned, a provider can add a WHERE clause that specifies a particular class.

    The next section will give you some introduction to schema queries and how to use them efficiently to solve our needs.

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


     

    VISUAL BASIC.NET ARTICLES

    - Movement and Player Statistics in a VB.NET T...
    - Creating and Drawing a Game Map in VB.NET
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - 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...





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