I have a Power Shell script that queries an xml document and outputs the results to a csv file. The script works, but I need to apply it to multiple xml files in a folder, then output the results as a separate csv for each XML with the same XML name. How can this script be modified to do this?
PROCESS
{
$xml = [xml](Get-Content .\sample.xml) #Sample XML
$xml.log.event | Select-object @(
@{l="times";e={$_.time}},
@{l="type";e={$_.type}},
@{l="user";e={$_.user}},
@{l="place";e={$_.place}},
@{l="message";e={$_.message}}) |
Export-Csv test.csv -NoTypeInformation
}