Advertisement

Extending PowerShell

  • Bryan Cafferky

Abstract

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 can be written in PowerShell script or in .NET languages like C#. Modules are one of the great extensibility features of PowerShell, and you can find many free modules available for download. Some, such as the SQL Server Module, SQLPS, are written by Microsoft, and others by vendors or the Windows community. We’ll discuss some of the popular modules available and how to use them.

Keywords

Dynamic Module Module Variable Foreign Currency Currency Conversion Switch Parameter 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Copyright information

© Bryan Cafferky 2015

Authors and Affiliations

  • Bryan Cafferky
    • 1
  1. 1.MAUS

Personalised recommendations