So, I am completely not understanding what you’re asking. I think you probably need to share some code snippets of what you’re doing.
As far as implementing your own -Filter parameter… that’s easy. Doing something with it depends entirely on what your code is doing. I mean, there’s no built-in “here’s how to write a filter.” For example,
function foo {
param([scriptblock]$filter)
Get-Something | Where-Object -Filter $filter
}
Essentially works, but I’ve no idea if that’s meaningful in what you’re trying to do. And I should point out that this is not functionally all that different from piping the whole function to Where-Object, if your function is normally outputting one object at a time to the pipeline. A filter is really only meaningful in a function if it can prevent data from entering PowerShell at all, a la the -Filter on Get-WmiObject. Once you’re “filtering using PowerShell,” it doesn’t necessarily matter where you do it (again, all things being equal – not seeing your code it’s hard to make definitive statements).