I want to do something like this-
"Error array cleared." | Out-File $ErrorLog $InfoLog -Append
However it's not working. Is this possible without writing another line to output it to the other file?
I want to do something like this-
"Error array cleared." | Out-File $ErrorLog $InfoLog -Append
However it's not working. Is this possible without writing another line to output it to the other file?
Found this snippet of code which does what I need-
"Test" | %{write-host $; out-file -filepath $ErrorLog -inputobject $ -append}
One way is with a short function like this:
Example:
(Writes the string "Out-FileMultiTest" to both test1.log and test2.log)
You can also use Tee-Object to accomplish the same thing. Look at example 3 on that page. Here is a quick sample that grabs the contents of the current directory and saves it to two files.