You can access the enumerations after loading the module using the using module ...
command.
For instance:
Mymodule.psm1
enum MyPriority { Low = 0 Medium = 1 high = 2 } function Set-Priority { param( [Parameter(HelpMessage = 'Priority')] [MyPriority] $priority ) Write-Host $Priority } Export-ModuleMember -function Set-Priority
Mark:
New-ModuleManifest MyModule.psd1 -RootModule 'MyModule.psm1' -FunctionsToExport '*'
Then in Powershell ...
Import-Module .\MyModule\MyModule.psd1 PS C:\Scripts\MyModule> [MyPriority] $p = [MyPriority ]::High Unable to find type [MyPriority]. At line:1 char:1 + [MyPriority] $p = [MyPriority ]::High + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (MyPriority:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound PS C:\Scripts\MyModule> using module .\MyModule.psd1 PS C:\Scripts\MyModule> [MyPriority] $p = [MyPriority ]::High PS C:\Scripts\MyModule> $p high
source share