All About Modules

One of the coolest new features of Windows PowerShell is PowerShell modules.  I’ve just written a tutorial about how to use them on my personal blog.

You can check out the full post for more details, but here are some easy things to remember about modules:

  • Modules can be scripts with functions, scripts that include other functions, or assemblies (DLLs) containing Cmdlets or providers
  • Modules let you cleanly separate code
  • Modules make it easy to depend on other code
  • Modules can contain private variables or functions
  • Modules let you refer to functions more explicitly (with & (Get-Module ModuleName) FunctionName )
  • You can take any .PS1 file that contains functions, and save it as a .PSM1, and you have made a module

The module examples also include a few PowerShell functions you might use in day-to-day life, such as being able to Search-WindowsDesktop, Get-RecordedTV, or Remove-RecordedTVBySeries, and are a great practical example of how you can use modules to cleanly separate code.   Check it out.

Hope this helps,

James Brundage [MSFT]