Previous Page
Next Page

Strings and Arrays

In this section, you'll use text files as an input into your script to dynamically create an array that you'll use to do real work. Why is this topic important? Even though we all know about the event log in Microsoft Windows Server 2003, many network administrators and consultants are unaware of the literally hundreds of other log files lying about on the hard disk drives of their networks. Indeed, lying about is an appropriate state for the vast majority of these log files because they contain little in the way of operational guidance for the enlightened network administrator. The following list summarizes uses for converting a text file into an array construction:

  • Import existing log files for ease of manipulation

  • Import comma-separated value (CSV) lists for ease of script operation

  • Import CSV files to control script execution

Just the Steps

To convert a text file into an array

1.
Identify a text file to convert to an array by using the fileSystemObject to point to the file.

2.
Use the InStr function to parse the data.

3.
Use the file system object to connect to a data source.

4.
Use a dynamic array to hold the data.

5.
Use LBound and UBound to set the limits when we iterate through the array.



Previous Page
Next Page