The code below:
For Each queryObj As ManagementObject In searcher.Get()
objWriter = New StreamWriter("C:\vsl\scripts\results.txt", False)
objWriter.Write("Active: {0} ", queryObj("Active"))
objWriter.Write(" InstanceName: {0} ", queryObj("InstanceName"))
objWriter.Write(" PredictFailure: {0} ", queryObj("PredictFailure"))
objWriter.Write(" Reason: {0} ", queryObj("Reason"))
objWriter.Close()
Next
Seems to fetch data from my one and only internal IDE drive.
Two things that I don't understand.
The line objWriter.Write("Active: {0} ", queryObj("Active")) does not work if you change up the data in between the first set of quotes. Thus changing Active: {0} to Active: {1} causes an error that the Try Catch doesn't catch (this for...next is in a try catch). I assumed that the stuff inside the quotes was just text and could be changed to anything? Why doesn't the try catch catch it?
Doesn't read a USB external drive when attached. That's how I found out about item 1 above... I changed {0} to {1} and it crashes.