Finding PowerShell Module Requirements

by Jul 22, 2013

PowerShell modules extend functionality by adding more cmdlets and/or providers. Modules support copy-and-paste deployment ("XCopy-deployment", if you like), so theoretically, you can copy any module from one computer to another and use it there (use Import-Module).

Practically, before you try this, you should ask yourself at least three basic questions:

            a) Is it legal?

            b) Where is the module stored?

            c) What are additional requirements the module may need?

To find out the location of a module, try this:

$module = Import-Module BitsTransfer -PassThru
$module.ModuleBase 

This will report the module folder. In this example, the module BitsTransfer is used which is part of PowerShell by default. If the module was loaded already, you can use Get-Module instead of Import-Module and omit -PassThru.

To find out required .NET assemblies, try this next:

$module.RequiredAssemblies

It will report back a list of DLLs. If these DLLs reside inside the module folder, all is fine. Else, you have external dependencies to take care of. Note that the assemblies reported here may internally have additional dependencies, so this is just a rough clue of what the module may need.

There are a lot of additional useful properties in $module you can explore.

Twitter This Tip! ReTweet this Tip!