Error Handling A Text File
Posted on 2004-09-23
I am working on a program that goes through a list of IP address (either from an imported text file or a list box) and retrieves information out of WMI then writes it to a CSV file. The problem I am having is handling errors (access denied, machine doesn't exist, etc).
Let's say I have a list of 10 IP's and 3 of them are turned off. So it goes through the first 3, retrieves the info and writes it to the CSV file. The 4th is turned off. The error needs to open that text file and write the IP and error description on it's line. After that, it goes to the 5th and 6th machines that work just fine. But 7 and 8 are turned off, so they need to write the error to the text file (and so on and so forth).
Basically, I can't figure out how to write the error and return to my program using the next IP address in the list.
Thank you for your help.