No announcement yet.

What to do when WMI Fails

  • Filter
  • Time
  • Show
Clear All
new posts

  • What to do when WMI Fails

    I have been playing around with creating reports that are using WMI. Since I pull the info from multiple WMI Classes I have to create multiple WMI Templates. Is there any way to create one template that can query multiple classes?

    Also when WMI can't connect Hyena just skips that computer in the report. When I import the other data I pull from the report in Excel the data doesnt match up. Is there a way to get Hyena to simply put a new line if WMI fails?

  • #2
    Re: What to do when WMI Fails

    Unfortunately WMI does not support querying multiple classes at the same time.

    The exports will not export anything if the computer is not available, so there would be no way to insert anything for skipped computers.


    • #3
      Re: What to do when WMI Fails

      An option for the output would be to also export a computer list, then merge those such as through Access by joining on the computer name. That way your data would not only line up, but you would be able to see the computers that were unsuccessful.


      • #4
        Re: What to do when WMI Fails

        The only problem with that is that I don't see any options in any of the other WMI queries for the computer name to be able to do that.

        The WMI Classes I use are Win32_ComputerSystem, Win32_BIOS, Win32_SystemEnclosure.

        Some advice on how to do this would be fantastic!!!

        I am currently using the Trial version. Would I need to purchase the full version to do what I need? My boss wants me to make sure it will work before we shell out the money for the program.

        Right now I have to manually go through and import everything into excel and then edit all the data to get everything to match up.


        • #5
          Re: What to do when WMI Fails

          The computer name is in the __SERVER WMI symbol. But if the computer is not available, you won't get anything in the output.

          If you enable the Computers export (not the WMI computers, but the Computers export), you will get a line in the output for each computer processed, even if the computer is offline or if an error is returned.

          I am not an Excel expert, but in MIcrosoft Access, if you imported all of your tables, you can easily join them in a query and have the computers table be the "outer joined table", thereby letting you see in your output every computer and joined with any WMI output (if any) for each computer.
          Kevin Stanush
          SystemTools Software Inc.


          • #6
            Re: What to do when WMI Fails

            OK I have all my reports adding the computer name to each text file.

            Has anyone created any sort of tutorials for importing this data into access?


            • #7
              Re: What to do when WMI Fails

              No, but try this for starters:

              (Note: Read item #5 first before starting exporting data)

              1. Create you output files. I created an export for computers, plus 2 WMI exports.

              2. Open Access and create a new database, ie WMI.mdb.

              3. Create tables for each of your exported files:

              - Select File->Get External Data->Import.
              - Change to the directory where the export files are located.
              - Change the data type to .txt
              - Select your first .txt file
              - Select the delimited data/file type, click Next
              - Set the delimiter (probably TAB which is the default), and check the box labeled “First row contains field names”, assuming that you had this option turned on in Exporter Pro (which it should have been for an initial export). Click Next.
              - Select “In a New table” on where to store the data
              - Click Finish.

              4. Repeat the above process for all exported files.

              5. Now create a query to join the data together. It helps if you look at the data first to ensure that the computer name which is going to be used for joining the data together is formatted the same in all of the tables. In general, the __SERVER field can be used for the computer name in any WMI exports. If joining data from a Computers export, it helps if the computer name or path is in Netbios format to match the WMI data.

              - Click the Queries tab/button on the left of the screen, then select “Create New Query in Design View”
              - Add your tables that you want to get data from. In this example, I’ll join data from the Computers table, plus two WMI queries for WMI_OS and WMI_ComputerSystem.
              - Access may automatically create join ‘lines’ to the ID fields, if so, remove them by clicking on them and pressing the Delete key.
              - If you are going to join a computers table (ie the ‘main’ table) with two or more other tables, it helps to move the tables around so that the computers table is more in the middle. Click on and just drag the table where you want it to be.
              - To create a join, click on the field and drag and drop it to the field that you want to join to. In my case, I want to join my computers “Path” field to the WMI __SERVER field. After creating the link, right click on the join line, and change the join type to be type “2”. This will force Access to output the computers that are missing from any output in the WMI tables.
              - Repeat this process for any other tables that you have.
              - Then, simply select the fields that you want to add to your query by double-clicking or drag/drop the fields from any table. By including one or more fields from the computers table, you will get a joined list of all computers in the export, plus any attributes from any table.

              6. Run your query and rerun until you are happy with the output.

              7. Save your query when done !
              Kevin Stanush
              SystemTools Software Inc.


              • #8
                Re: What to do when WMI Fails

                Awesome!!!! This worked beautifully! Much easier than importing with excel. Now I just need poke around excel to format the data how i want it.

                Thank you so much!