This week I presented a Festive Tech Calendar 2023 session about building a PowerShell Module. This post includes a link to the session recording and some accompanying resources.
See this and many other sessions on the FestiveTechCalendar.com website and YouTube Channel.
Rudolph the Red-Nose Reindeer is well known for having a very shiny nose, but he also has a lot of PowerShell scripts and functions that he’d like to share with his reindeer friends. Join our friendly caribou as he packages this code into his first PowerShell Module and shares it with Dasher, Dancer, and the other reindeer.
Or, if you’re watching this the other 11 months of the year, find out how to create a shareable PowerShell module from your existing functions.
Code
The example code used to create Rudolph’s module can be found on Github
PowerShell from Demos
1# List all the available Modules2Get-Module-ListAvailable3#Find the Module that Get-Item belongs to4Get-CommandGet-Item5Get-Module-ListAvailableMicrosoft.PowerShell.Management6#Find all the Azure Modules7Get-Module-ListAvailableAz.*
1# Generate function Manifest2New-ModuleManifest-Path.\RudolphsTools.psd1`3-NestedModules@('.\Get-ChristmasTree.psm1','.\Get-DaysTillChristmas.psm1','.\Get-ExampleNaughtyList.psm1','.\Get-NextChristmasDate.psm1')`4-Guid(New-Guid)`5-ModuleVersion'0.0.0.1'`6-PowerShellVersion$PSVersionTable.PSVersion.ToString()`7-FunctionsToExport@('Get-ChristmasTree','Get-DaysTillChristmas','Get-ExampleNaughtyList','Get-NextChristmasDate')
1#Import the new Module2Import-Module.\RudolphsTools.psd13#Get all the Commands in the new module4Get-Command-ModuleRudolphsTools