October 4th, 2012

PowerTip: Split PowerShell Output Between Console and Variable

Doctor Scripto
Scripter

Summary: Learn an easy way to save Windows PowerShell output in a variable and still output to the console.

Hey, Scripting Guy! Question What is an easy way to display Windows PowerShell output from a cmdlet to the console, and yet store the results in a variable at the same time?

Hey, Scripting Guy! Answer Use the OutVariable parameter:

           GSV -OutVariable S

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback