Reputation: 3209
We have a Powershell script that gives some helpful output, but we don't want users to always see this and would like it to be silent at all times when called in a certain environment. This script calls other scripts, if that matters.
I've tried doing something like $silence = & G:\scripts\functions.ps1 >$null
, but I still get output.
What can I do to silence ALL output that comes from functions.ps1
?
Upvotes: 2
Views: 652
Reputation: 1095
it sounds like you're dealing with output from more than one data stream! If it were me I'd redirect all streams to the output stream and then get it going to $null.
If the stream discussion sounds like gibberish, or my answer doesn't meet your needs check out this: http://technet.microsoft.com/en-us/library/hh847746.aspx
.\script.ps1 *> $null
Upvotes: 4