Is there a simple way to combine the functions of this Powershell script? It would be nice to have it file to one output file instead of several output files.
GET-DATE WRITE-EVENTLOG -logname Application -Source BLERG -EventID 1000 -entrytype Information -message "START CBM_PARSE.ps1" -category 1 ###################################################################### ###################################################################### $SA_Location = "E:\Users\jsweeton\Documents\SITES\CBM\Storage Analysis\CBM-FS3" SET-LOCATION $SA_Location $filenames = @(GET-CHILDITEM $SA_Location -recurse -include *.csv) $regex = '^([^-]+-[^-]+)-([A-Z])-(\d{4})(\d\d)(\d\d).+' # $PIPE = "," $PIPE = "$([char]0x2C)" # $SLASH = "\" $SLASH = "$([char]0x5C)" # $DSLASH = "\" $DSLASH = "$([char]0x5C)$([char]0x5C)" foreach ($file in $filenames) {$outfile = "$file" + ".out" $ReplaceString = ($file | Split-Path -leaf) -replace $regex,'$1|$3-$4-$5|$2:' ((GET-CONTENT $file| Out-String).Substring(7)) | FOREACH-OBJECT -Verbose { $_ -replace "\\","\\" ` -replace $PIPE,"|" ` -replace "E:",$ReplaceString ` } | SET-CONTENT $outfile } GET-DATE WRITE-EVENTLOG -logname Application -Source BLERG -EventID 1002 -entrytype Information -message "END Parsing" -category 1 ECHO "END PARSE" ###################################################################### ###################################################################### GET-DATE WRITE-EVENTLOG -logname Application -Source BLERG -EventID 1000 -entrytype Information -message "START CBM-FS3" -category 1 GET-CONTENT (GET-CHILDITEM "E:\Users\jsweeton\Documents\SITES\CBM\Storage Analysis\CBM-FS3\*.out") | out-file -encoding "UTF8" "C:\Users\jsweeton\Documents\SITES\CBM\Storage Analysis\CBM-FS3\CBM-FS3.txt" WRITE-EVENTLOG -logname Application -Source BLERG -EventID 1002 -entrytype Information -message "END CBM-FS3" -category 1 ECHO "END CBM-FS3" <# GET-DATE WRITE-EVENTLOG -logname Application -Source BLERG -EventID 1000 -entrytype Information -message "START CBM-FS56" -category 1 GET-CONTENT (GET-CHILDITEM "C:\Users\jsweeton\Documents\SITES\CBM\Storage Analysis\CBM-FS56\*.out") | out-file -encoding "UTF8" "C:\Users\jsweeton\Documents\SITES\CBM\Storage Analysis\CBM-FS04\CBM-FS04.txt" WRITE-EVENTLOG -logname Application -Source BLERG -EventID 1002 -entrytype Information -message "END CBM-FS56" -category 1 ECHO "END CBM-FS56" #> GET-DATE WRITE-EVENTLOG -logname Application -Source BLERG -EventID 1002 -entrytype Information -message "END CBM_PARSE.ps1" -category 1 ECHO "END END" ###################################################################### ######################################################################