function Add {
[CmdletBinding()]
param (
[int] $x
, [int] $y
)
return $x + $y
}
Export-ModuleMember -Function Add
This is a simple example of what a PowerShell script module file might look like. This file would be called MyCoolModule.psm1
, and is referenced from the module manifest (.psd1) file. You'll notice that the Export-ModuleMember
command enables us to specify which functions in the module we want to "export," or expose, to the user of the module. Some functions will be internal-only, and shouldn't be exposed, so those would be omitted from the call to Export-ModuleMember
.