I have a Powershell 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 and output the combined results to a csv. How can this script be modified to do this? Thanks
$xml = [XML](Get-Content D:demo\test.xml) #load xml document
#this finds file names of yearbook picks
$picks = $xml.Client.Order.Ordered_Items.Ordered_Item |
Where-Object { $_.Description -eq 'yearbook Luster Print' } |
ForEach-Object { $_.Images.Image_Name }
# this finds the Album
$album = $xml.SelectSingleNode("//Album_ID").InnerText -split '_'
$results = New-Object PSObject -Property @{
Last= $album[0]
First= $album[1]
Code= $album[2]
Pick1= $picks[0]
Pick2= $picks[1]
}
#output CSV File
$results | Export-Csv -path D:\demo\myoutput.csv -NoTypeInformation
Aucun commentaire:
Enregistrer un commentaire