From the course: Complete Guide to PowerShell 7

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Function libraries and modules

Function libraries and modules - PowerShell Tutorial

From the course: Complete Guide to PowerShell 7

Function libraries and modules

- [Narrator] So, so far we've talked about creating basic functions, adding parameters, advanced handling, validation, reusable functions, and obviously formatting the return data. Now what we're going to talk about now is actually packaging all of this up together. So the first thing I've got is three functions, so Get-Greeting, Add-Numbers, and Get-CurrentTime. These functions are not available to me at the moment 'cause I haven't executed these, but I want to copy these and put these into my functions and put them into a separate ps1 file. What I can then do is just simply load that. So use dot and then the path to the file. I'm going to say run selection, and then I can use those functions in the bottom section. So sure enough, it says hello. If I add the numbers, it'll add the numbers. If I do current time, it will do the current time. So fairly straightforward. Now if I wanted to package this up even further, then I'll want to create it as a module. Now the first task I'm going…

Contents