How can I export the results of my script to file?
Posted
by
Meepster
on Server Fault
See other posts from Server Fault
or by Meepster
Published on 2013-06-29T01:17:40Z
Indexed on
2013/06/29
4:22 UTC
Read the original article
Hit count: 384
powershell
|Xml
I need to get some details out of hundreds of XML files that were written for reporting. The script below provides the correct results, but I want them in file, cvs, xls, or txt so I can provide a list of the database fields that are in use by these reports.
$get = get-childitem D:\Data\Desktop\Projects\Reports\Test -include *.xml -recurse
ForEach ($xmlfile in $get)
{
$Report = $xmlfile
$Fields = [xml](Get-Content $Report)
$Fields.reportsettings.fieldlist.field | select @{ L = 'Description'; E = {$_.desc}},
@{ L = 'Field Name'; E = {$_.criterion}},
@{ L = 'Field ID'; E = {$_.id} } }
Thank you very much for your time!
© Server Fault or respective owner