PowerShell script module starter kit

Background

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.

Sample Project

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s