Video: PowerShell Non-Monolithic Script Module Design

This past Tuesday night, I presented a session on “PowerShell Non-Monolithic Script Module Design” for the Arizona PowerShell Users Group. The video from that presentation is now available.

The presentation begins at 10 minutes and 30 seconds seconds into the video.

The presentation materials to include the slide deck and code can be found in my presentations repository on GitHub.

µ

1 Comment

  1. Justin Allen

    Hey Mike, loved the video. Definitely a huge help to a beginner like myself.

    I love the concept of breaking everything out into their own PS1s, but I am running into an issue I hope you can help resolve.

    Previously it was easy to hide helper functions, by either explicitly Export-ModuleMember -Function New-Usefulfunctions (which would only export the functions I intend) or with FunctionsToExport in the manifiest. Since my helper functions were already in my giant monolithic scripts, they stayed hidden from end users and were functional.

    However, now that I’ve broken every function out into it’s own ps1 file (including my helpers), I can’t find a way to hide them and still have them work. If I explicitly Export-ModuleMember only my Public functions, I end up with things failing left right and center as soon as they call a helper function that wasn’t exported. Same goes for FunctionsToExport @(New-UsefulfunctionsOnly).

    Did I misunderstand and approach my design incorrectly? Should I leave the helper functions in my main scripts, or place them in my psm1? Currently my PSM1 is just finding and dot sourcing *.ps1 files – there is no real content at all in the PSM1.

    Reply

Leave a Reply

%d bloggers like this: