The CommandAssist module allows you to easily create proxies functions for every command in a module (or snapin).  

There is a handy command to generate these proxy modules included with the CommandAssist module. 

image

Building an Assisted Module

The easiest way to explain what happens is to walk through the usage of New-AssistedModule.  To that end, we'll create a proxy of a module that I've been use regularly - the ActiveDirectory module.

NOTE: You will need to have ShowUI available in your module path (you can check with Get-Module ShowUI).  You do not need to have it loaded into your session, CommandAssist will take care of that.

First we'll load the CommandAssist module:

Import-Module CommandAssist

Second we will load the module we want to create a proxy for:
Import-Module ActiveDirectory
**NOTE: **This only has to be done the first time to create the proxy.  Afterward, the proxy module will load the real module in the background.



Third we will use New-AssistedModule to create our proxy module.

$NewModulePath = c:\users\smurawski\Documents\WindowsPowerShell\Modules\AssistedAD
Get-Module ActiveDirectory | 
    New-AssistedModule -ModulePath $NewModulePath

image

As noted in the screenshots, the module created has proxies for each command that add the -assist parameter.  There also is a module file that will load all of the proxies, as well as the source module (in this example, AssistedAD.psm1).

The next post will review how the -Assist parameter works.

*NOTE: *The proxy module will load the real module in the background (so if you distribute it, the end user will need the source module or snapin as well).

Want more great reading? Check out my reading list!