PowerShell functions are an essential tool for extending the PowerShell ecosystem with your own custom code. Modules are great because they allow you to package a collection of functions into a container for easier distribution and usage.
One of the hurdles for starting to write your own modules is finding a good file or folder structure. The old advice has been to just cram all the functions into a single .psm1 file and call it good. This might work for smaller modules, but quickly becomes a nightmare for large projects or projects with multiple developers.
Instead of going into detail describing the structure, it will be easier to just see an actual sample on GitHub.
I wrote this starter kit since I’ve been working on new modules lately and this seems to be a good re-usable pattern. The sample includes the manifest (.psd1) and root module (.psm1), public and private functions, v5 classes, and unit tests (Pester framework).
Project link: PowerShell Module Starter Kit
One thought on “PowerShell script module starter kit”