Output to Console AND Variable

by Mar 29, 2012

To assign results to a variable and at the same time view these results in your console, place the assignment operation into parenthesis:

($result = Get-Process)

As you will see, the processes will still appear in your console. At the same time, they also get saved to the variable $result.

Twitter This Tip! ReTweet this Tip!