PowerShell: Module Basics - Paiet/Tech-Journal-for-Everything GitHub Wiki

Module Basics

  • Modules have a .psm1 file extension
  • Modules are stored in several places
    • $env:PSModulePath -split ';'
  • Put module in a folder with the same name as the .psm1 file
  • Module manifests
    • Store metadata about the module as a hashtable
    • .psd1 file extension
    • Name should match folder
    • New-ModuleManifest
$manifest = @{
    Path              = '.\MyFunctions\MyFunctions.psd1'
    RootModule        = 'MyFunctions.psm1'
    Author            = 'Mike Rodrick'
}
New-ModuleManifest @manifest