PowerShell: Import-Module, but no "ExportedCommands" available PowerShell: Import-Module, but no "ExportedCommands" available powershell powershell

PowerShell: Import-Module, but no "ExportedCommands" available


Two things:

  1. Make sure you're using a module manifest file (.psd1 file). More information can be found in How to Write a Module Manifest

  2. Most importantly, edit your manifest file and make sure it references your root module as follows:

    RootModule = 'name of your module'

I just finished fighting with this for a few hours and I couldn't figure out what I was missing from my other modules. This did the trick for sure!


One other requirement: ensure that the cmdlet class is public. For example, in my .cs file I initially had:

[Cmdlet(VerbsCommon.Get, "Proc")]class GetProcCommand : Cmdlet{ ...

Even after adding a manifest file with RootModule set, Get-Module continued to show no ExportedCommands after my Import-Module. To fix it I just marked the class as public and rebuilt my .dll assembly:

[Cmdlet(VerbsCommon.Get, "Proc")]public class GetProcCommand : Cmdlet{ ...

I figured this out while examining my .dll using ildasm - I noticed that some of my classes were public, but my cmdlet class was private.


It may be that the psd1 file (the module manifest) does not contain the commands.

This page has a tutorial on how to create a module manifest.