Someone knows for which strange reason Powershell doesn't show de 'tee'd' variable in the following snippet?
# a.txt contains any text
cat a.txt | tee -variable foovar | % { 'value of foovar: ' + $foovar }
In practice, I'd like to do, in only one line, a search for some text and then, based on the results, process the text, for example send a mail with it:
get-content [somefile] | select-string [somePattern] | tee [var] | ..[more processing] | .\sendmail.ps1 [var]