Ian Davis
Ian Davis

Reputation: 3868

Is it possible to use Export-ModuleMember with PowerShell filters

Say I have a filter defined in a PowerShell module:

filter OddNumbers {
  $value = $_
  $value | ? {($_ % 2)}
}

First, is it possible to export this filter using Export-ModuleMember? Second, if it is possible, what is the syntax?

Upvotes: 4

Views: 294

Answers (1)

Mike Shepard
Mike Shepard

Reputation: 18176

Have you tried

Export-modulemember -function OddNumbers

A filter is a special kind of function so this should work.

Upvotes: 4

Related Questions