Managing PowerShell Modules

In PowerShell v.2, all new modules work like libraries and can be loaded using Import-Module to gain access to all public functions, variables, aliases etc. like this:

Import-Module path_to_module\mymodule.psm1

A better way is to store a reference to your module in a variable which requires the -passthru parameter:

$module = Import-Module path_to_module\mymodule.psm1 -passThru

$module | Get-Member will show you all the useful methods you can now access. For example, it tells you just which functions, aliases, variables, etc. are available from this module.

Twitter This Tip! ReTweet this Tip!


Posted Sep 17 2009, 08:00 AM by ps1

Comments

Episode 84 – Hal and Jonathan talk PowerShell « PowerScripting Podcast wrote Episode 84 – Hal and Jonathan talk PowerShell « PowerScripting Podcast
on 09-20-2009 5:58 PM

Pingback from  Episode 84 – Hal and Jonathan talk PowerShell «  PowerScripting Podcast

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.