Function calls will override the cmdlets. You can read more about this from about_Command_Precedence on TechNet ...
If you do not specify a path, Windows PowerShell uses the following order of priority when executing commands:
- Alias
- Function
- Cmdlet
- Windows native commands
This way, just creating a function with the same name as the native cmdlet will give you what you want.
function Write-Host{ Process { # Executes once for each pipeline object If ($_ -match "bagels"){ Microsoft.PowerShell.Utility\Write-Host $_ -ForegroundColor Green }else{ Microsoft.PowerShell.Utility\Write-Host $_ } } }
So now write-host works with pipelined input, with which we can filter. Calling a "real" cmdlet is as simple as specifying a module in a call. You can see that I did this twice in the above code example. Some examples of usage and output will be as follows:

Be careful that you do not forget that you did this if you save it in your profile or something like that. Use Get-Command Write-Host whenever in doubt. In my case, you can remove the override by calling Remove-Item function:write-host
You can also see what is called proxy functions, but I think this is too much for what you intend to do.
source share