Overriding Out-Default (Part 1)

by Jul 3, 2019

Out-Default is a hidden PowerShell cmdlet that gets called at the end of each command, and outputs results to the console. You can override this function with your own. If you overwrite it with an empty function, for example, all output is discarded – or results in a “SECRET!” message:

function Out-Default
{
    'SECRET!'
}

This is how you remove custom overrides:

 
PS C:\> del function:Out-Default
 

Twitter This Tip! ReTweet this Tip!