Given a query such as
SELECT * FROM WIN32_PROCESS
Is there a way to interrogate the result object for the names of the columns returned?
Yes. Each WMI object has the Properties_
collection that provides information about that object's properties. To get the names of properties available in an object, enumerate the Properties_
collection and check each item's Name
.
Write all the rows in the result object to a text file, say
Enumerate all the rows and use the FileSystemObject
to write them to the desired text file. Pseudocode:
create a text file and open it for writing
for each object in the result set
for each property in the object
write the property value to the file
close the file
Alternatively, you could use wmic
to do all the work for you:
wmic /output:e:\processes.txt process get /all
wmic /output:e:\processes.csv process get /all /format:csv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With