Click here to Skip to main content
Click here to Skip to main content

AidaNet : Network resources inventory

, 7 Mar 2004
Rate this:
Please Sign up or sign in to vote.
XPath script to analyze multiple XML files.

Introduction

AidaNet is an XPath script that displays XML information generated by the freeware tool Aida32. AIDA32 is a professional system information, diagnostics and benchmarking program running on Win32 platforms. It extracts details of all components of the PC. It can display information on the screen, print it, or save it to file in various formats like HTML, CSV or XML. For corporate users, AIDA32 offers command-line switches, network audit and audit statistics, remote system information and network management. Ensure you have at least version 3.83.

Download Aida here.

Background

The good news is that you don't have to run Aida on each computer to make the inventory.

How to create XML files? (The demo is provided with only a few XML files).

Just add this line in the user logon script:

shell "cmd /c \\Myserver\aida\aida32 /R \\Myserver\aida\Reports\$hostname
                                                         /XML /AUDIT /SILENT"

Then just wait a few days, ensuring that everyone login on the network and you can know what programs are installed on your company, who has the bigger RAM, what is the most used 'default printer' and so on.

Using the code

AidaNet doesn't have any knowledge of Aida XML structure. The program uses a script to display information. For each useful information you want to display, add an Alias entry on the AidaNet.xml file using XPath string. Since an XML can be complex (the case of Aida files), AidaNet allows you to define sub Alias:

<Config>
   <FolderPath>..\\..\\sample</FolderPath>
   <Alias Path="/Report">
      <Alias Path="Page[Title='Summary']">
         <Alias Path="Group[Title='Computer']">
            <Alias Name="OS_NAME" Title="Name"
             Path="Item[Title='Operating System']/Value" />
            <Alias Name="OS_SP" Title="Service Pack"
             Path="Item[Title='OS Service Pack']/Value" />
            <Alias Name="PC_NAME" Title="PC Name"
             Path="Item[Title='Computer Name']/Value" />
            <Alias Name="USER_NAME" Title="User name"
             Path="Item[Title='User Name']/Value" />
         </Alias>
         <Alias Path="Group[Title='Motherboard']">
            <Alias Name="CPU_FULL" Title="CPU Name"
             Path="Item[Title='CPU Type']/Value" />
            <Alias Name="RAM" Title="RAM"
             Path="Item[Title='System Memory']/Value" />
         </Alias>
      </Alias>
   </Alias>
   <Group Name="OS" Title="Operating Systems">
      <Alias Name="OS_NAME"/>
      <Alias Name="OS_LANG"/>
      <Alias Name="OS_SP"/>
   </Group>
</Config>

The OS_NAME Alias is then a sub alias of the Group[Title='Computer'] path, itself a path. This Alias is also part of the Group Name="OS". All Alias of a group represent a single value. You can't filter computer having a specific service pack, without associating it with the type of OS (NT4 SP1 and XP SP1 are different). It's possible to group Alias that don't start at the same level, but alias occurrences must be the same.

Since version 1.5, Group tags can be defined only in the Config tag, no more in Alias tags. Alias name attributes in Group tag are also changed to Text. Sorry for those that already use 1.0 version.

Starting demo

The first thing to do is to modify aidaNet.xml file. The Config/FolderPath value should point to where you placed your Aida XML files. Then start the program and let start collecting info with the File/Analyse menu. AidaNet will try to find the aidaNet.xml file in the current folder. If not found it will open it 2 folder levels up.

Using the demo

The "filter selection" grid (on top) displays all Aliases and Groups names. The "corresponding files" grid (on bottom) columns grids and the "detail" grid (on right) are defined in the same XML script file (FileGrid tag and DetailGrid tag respectively). "Filter selection" and "corresponding files" columns grids can be sorted.

Exporting results

You can export data in the 3 grids to a text file. Tabulation is used to separate fields on the same line. The export saves only what is visible on the grids, because saving all PC information where 'Internet Explorer " is installed can produce many pages of report.

Points of Interest

AidaNet can be used for other kind of XML files, like XML book files. It's a nice example of XPath use. It's a FLWOR statement (FOR-LET-WHERE-ORDER-RETURN) like program (still not available).

This program uses 2 ways to read XML files:

  • XPathDocument to read AIDA files. XPath is then used to retrieve values.
  • XML schema. Microsoft XSD can generate C# code from schema. See XML Data Files, XML Serialization, and .NET or Search for "XML serialization" in CodeProject for more information.

Improvements

Next version will provide an XPath editor.

ListView bonus

The project comes with a Listview helper class that allows column sort with up and down sort indicator picture. This class is not another ListView subclass, you can use it with existing code. Sample use:

  using ListViewHelper
  ...
  public ListViewSorter MySorter ;
  ...

  // Create the Sorter
  MySorter = new ListViewSorter (MyListView) ;

  // automatic user sort on header click
  MyListView.ListViewItemSorter =  MySorter ;

  // You must specify the array containing the 2 sort pictures.
  MyListView.TableArrows = imageList1 ;
  ...

  // Sort by code. First arg is the column used to sort the list
  MySorter.SortBy (MyColumnHeader , SortOrder.Ascending)

The same class allows to resize all columns. Microsoft provides const for optimizing column width based on the header OR items, but not both. ResizeColumns function resizes all columns to the largest width.

Sample use:

MySorter.ResizeColumns() ;

History

  • February 2004 : Version 1.0
  • March 2004 : Version 1.5 : Added validations, text export and uses XML serialization

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Thierry Parent
Architect
Belgium Belgium
No Biography provided

Comments and Discussions

 
General[Message Removed] Pinmemberhankjmatt13-Oct-08 22:11 
GeneralCompiling Pinmemberfrostie2001uk14-Dec-04 23:50 
GeneralRe: Compiling Pinmembercarguellou26-Oct-05 5:54 
Frostie, did you get an answer?
 
I've the same problem.
 

 
Regards,
Carlos
GeneralRe: Compiling PinsussAnonymous26-Oct-05 20:53 
GeneralRe: Compiling [modified] PinmemberInti3112-Nov-05 22:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 8 Mar 2004
Article Copyright 2004 by Thierry Parent
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid