How to convert snap-in into module?

Hello, experts,

Ive done a quick google search and been unable to find any straightforward instructions. Dont you happen to know, dear gentlemen, what steps one should take to convert custom PS snap-in into PS module?

I know that Im mostly likely several years late with this question, but still want to get to the heart of the matter. Any insights would be appreciated.

Kind regards, Leonardo.

February 18th, 2015 7:20am

Developers can help you out.

But I do load snapins like module using Below

$module = Get-PSSnapin -Registered -Name Quest.ActiveRoles.ADManagement
Import-Module $module.ModuleName -Verbose


If your custom snapins has dll. You can do like below

Import-Module 'C:\Program Files\Quest Software\Management Shell for AD\Quest.ActiveRoles.ArsPowerShellSnapIn.dll' -Verbose

I just made the above code because I use to forget Add-PSSnapin :) Still SharePoint, PowerCLI VM Ware and Quest use snapins

Free Windows Admin Tool Kit Click here and download it now
February 18th, 2015 8:47am

As far as I know, the only difference in the assembly itself is the presence of a class that inherits from PSSnapin or CustomPSSnapin; this class serves much the same purpose as the module manifest, which was added later.  The cmdlets themselves should be written the same way, and probably just work regardless of whether they're loaded as a snapin or as a module.

On the other hand, it's taken PowerCLI ages to convert even a portion of their code from snapin to module, so maybe there are other challenges I'm not aware of.

February 18th, 2015 8:55am

This is more of a developer question rather than a general Powershell question so you may be better served on the MSDN forum.
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2015 9:08am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics