Search code examples
powershellpowershell-module

Powershell - Export-ModuleMember doesn't work


I'm new with PowerShell and I've just started to create my own module. I created the script & manifest files and placed them into the directory C:\Program Files\WindowsPowerShell\Modules\ who is one listed of the $env:PSModulePath command.

I can import and remove the module as well but it's not recognized as an applet or command when I try to call one of the function.

I use the Import-Module command :

Import-Module MyModule

My script file is something like this :

function MyFunction() {}

Export-ModuleMember -Function *

And my manifest looks like this :

FunctionsToExport = '*'

Do I need to write all of the exported functions into the manifest ?

Thank you for your help.


Solution

  • Ok so after a few hours I found the answer : ExportedCommand empty custom module PowerShell

    You need to put RootModule = 'MyModule.psm1' into the manifest.

    Have a nice day !