CHAPTER 6

image

Extending PowerShell

To load a single function for use in a script, we use the dot-sourcing method discussed previously. However, what if we have many related functions that we want to make available to our script? Do we need to dot source each function individually? Fortunately, the answer is no. PowerShell provides an elegant way to group a set of functions together into a module so they can be loaded in just one statement. We’ve already used this feature in previous examples, and now we’re going to discuss how we can create our own modules. We will also cover how to merge multiple script files into a module by using a manifest. Modules ...

Get Pro PowerShell for Database Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.