Duplicate Output

by Jul 1, 2011

Sometimes, you may want to store command results in a variable and at the same time, output it to the console. Once you assign results to a variable, however, the console will no longer show the results:

PS> $result = Get-Process

 

You should place the line in parenthesis to store the results in a variable and also output the results to the console:

PS> ($result = Get-Process)

 

Twitter This Tip!
ReTweet this Tip!