Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

System Center Configuration Manager 2007 : Creating Queries (part 1) - Objects, Classes, and Attributes

11/21/2011 9:10:22 AM
The built-in queries are just a sample of the data available in ConfigMgr. You will want to review the properties of the built-in queries to get a better idea of how they are created, and then begin building your own queries!

Creating queries is a safe way to obtain data from ConfigMgr. When you use the Query Builder, the class joins are automatically created, thus reducing the risk of an improper join that could be resource intensive. The following sections provide additional insight into the query language, as well as the types of objects you can query.

The Query Language

ConfigMgr queries use the WMI Query Language (WQL) to gather information from the site database. In this way, queries differ from Configuration Manager reports , which use standard SQL syntax to access database information. ConfigMgr uses WMI for much more than just ConfigMgr queries. The ConfigMgr Software Development Kit (SDK) is a great place to learn more about WMI and WQL as well as Configuration Manager’s use of these technologies.


About WQL

As Microsoft states at http://msdn.microsoft.com/en-us/library/aa394606(VS.85).aspx, WQL is a subset of the American National Standards Institute Structured Query Language (ANSI SQL) with minor semantic changes. This MSDN site lists WQL keywords. The keywords built with WQL are used to control the WMI service. Think of it as a repository of properties and methods related to the system environment that you would access similar to accessing a database.


Objects, Classes, and Attributes

Prior to building queries, let’s discuss the terminology and the objects you will use. When selecting data in a query, you select an object type, one or more attribute classes, and one or more attributes. These terms are defined in the following list:

  • Object type— A set of attributes that represents a ConfigMgr database object, such as a client, package, or advertisement. Table 1 shows the object types available for queries.

    Table 1. Object Types Available for ConfigMgr Queries
    Object TypeDescription
    AdvertisementA single attribute class that contains the data in a ConfigMgr advertisement, such as advertisement name, advertisement ID, package ID, package name, and more. This class will not tell you the advertisement status, but describes the properties of an advertisement.
    Software Metering RulesA single attribute class containing the data in a ConfigMgr software metering rule, such as rule name, filename to meter, and whether the rule is enabled. This class will not tell you metering rule summary information, but will tell you the properties of the rule.
    PackageA single attribute class that contains the data in a ConfigMgr package, such as package name, package ID, source path, and more.
    ProgramA single attribute class containing the data in a ConfigMgr program, such as program name, package ID (to associate the program with a package), dependent program package information, and more.
    SiteA single attribute class that contains the data in a ConfigMgr site, such as server name, build number, and site version.
    System ResourceMany attribute classes containing the data for a computer system, such as discovery information, hardware and software information, and so on, are System Resource objects.
    User ResourceA single attribute class that contains the discovery data for user objects, such as user name, full user name, and user Organizational Unit (OU). Use this class when building queries that can be imported into collections for user-targeted advertisements.
    User Group ResourceA single attribute class containing the discovery data for user group objects, such as user group name and domain. Use this class when building queries that can be imported into collections for user group–targeted advertisements.

  • Attribute class— A container object that groups related attributes. For example, the Processor attribute class contains attributes such as Device ID, Manufacturer, Resource ID, and more. You can control many of the attributes in the attribute class by modifying the attributes collected in inventory by modifying the SMS_Def.mof file. Most attributes you will use in ConfigMgr queries are members of the System Resource Object type, because all hardware and software inventory information is a member of this object type. If later you decide to build a web report (which uses SQL instead of WQL), you will find a SQL view with a similar name. As an example, the Computer System attribute class in WQL has a corresponding SQL view named v_GS_COMPUTER_SYSTEM.

  • Attribute— The specific property that the query searches in criteria and/or displays for query results.

Figure 1 provides an example of object types and their relationships discussed in this section. It shows the selected object type System Resource. Within the System Resource object type, three attribute classes (Processor, Operating System, and Add/Remove Programs) are selected. The lines between each object type represent the joins that are required between classes. Here is the WQL equivalent of Figure 1:

select SMS_G_System_PROCESSOR.MaxClockSpeed, SMS_G_System_PROCESSOR.Name,
SMS_G_System_OPERATING_SYSTEM.OSLanguage,
SMS_G_System_OPERATING_SYSTEM.Version,
SMS_G_System_ADD_REMOVE_PROGRAMS.Publisher from SMS_R_System inner join
SMS_G_System_PROCESSOR on SMS_G_System_PROCESSOR.ResourceId =
SMS_R_System.ResourceId inner join SMS_G_System_OPERATING_SYSTEM on
SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId inner join
SMS_G_System_ADD_REMOVE_PROGRAMS on
SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceId = SMS_R_System.ResourceId


Figure 1. Example of Query object types, attribute classes, and attributes


As you can see from this code, WQL looks very similar to SQL. You will also notice that no criterion is specified (the query does not contain a WHERE clause). This particular example did not specify criteria, which is another feature of ConfigMgr queries—you may want to see all the data on occasion. You will learn in the next section how you can easily create a WQL query with criterion.

Other -----------------
- System Center Configuration Manager 2007 : Configuration Manager Queries - Viewing Queries and Query Results
- Microsoft Systems Management Server 2003 : Disaster Recovery - Scheduling Maintenance Tasks
- Microsoft Systems Management Server 2003 : Disaster Recovery - Database Maintenance
- Windows Server 2008 Server Core : Performing a Formatted Printout with Notepad
- Windows Server 2008 Server Core : Obtaining General System Information with the MSInfo32 Utility
- SQL SErver 2008 R2 : Parallel Query Processing
- SQL SErver 2008 R2 : Other Query Processing Strategies
- Configuring and Using Active Directory Certificate Services (part 4) - Protecting Your AD CS Configuration
- Configuring and Using Active Directory Certificate Services (part 3) - Considerations for the Use and Management of AD CS & Working with Enterprise PKI
- Configuring and Using Active Directory Certificate Services (part 2) - Finalizing the Configuration of an Online Responder
 
 
Top 10 video Game
-   Uncharted 4: A Thief's End | E3 2015 Extended Gameplay Trailer
-   V.Next [PC] Kickstarter Trailer
-   Renowned Explorers [PC] Launch Date Trailer
-   The Void (Game Trailer)
-   World of Warships [PC] Open Beta Trailer
-   F1 2015 | Features Trailer
-   Battle Fantasia Revised Edition | Debut Trailer for Steam
-   Victor Vran [PC] Story Trailer
-   Star Wars Battlefront PC Alpha footage
-   Skyforge [PC] Open Beta Gameplay Trailer
-   Armored Warfare [PC] PvE Trailer
-   F1 2015 [PS4/XOne/PC] Features Trailer
-   Act of Aggression [PC] Pre-Order Trailer
-   Sword Coast Legends [PC] Campaign Creation E3 2015 Trailer
-   Sword Coast Legends [PC] Campaign Creation E3 2015 Dungeon Run Trailer
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
Popular keywords
HOW TO Swimlane in Visio Visio sort key Pen and Touch Creating groups in Windows Server Raid in Windows Server Exchange 2010 maintenance Exchange server mail enabled groups Debugging Tools Collaborating
programming4us programming4us
PS4 game trailer XBox One game trailer
WiiU game trailer 3ds game trailer
Trailer game
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer