- March 17, 2016 at 5:03 pm #36673
I have a series of modules (41) that are designed to work together but can be imported separately if needed. When the modules are installed in C:\Program Files\WindowsPowerShell\Modules\, it imports with no issue. At this point, we have a simple script that copies all of the modules directly into C:\Program Files\WindowsPowerShell\Modules, and all works well.
However, I would like to be able to use PowerShellGet to create a module package that contains all of the modules together and be able to distribute them as a whole, since they are versioned that way. Ideally the modules would be part of a single parent module that would be the basis for the PowerShellGet package. I attempted to publish a parent module with a manifest, empty root (PSM1) module, and all of my other modules contained in the parent module folder. After publishing to an internal SMB repository, the module installs fine, I am able to see them when I run Get-Module -ListAvailable, however they are unable to be imported the normal way (Import-Module ). For some reason, doing Get-Module -ListAvailable | Import-Module DOES work. What is going on here? What am I missing?
Sorry to be so long-winded and potentially confusing. I am thoroughly confused myself. 😉March 17, 2016 at 11:15 pm #36678
In the module manifest for the parent you can specify all the child modules in the NestedModules tag and they should all be imported automatically when the parent is imported.March 18, 2016 at 11:39 am #36727
Thanks for the reply. The problem with that is many of the nested modules can be used on it's own, so I'd prefer not to load all 41 modules (around 55k lines of PowerShell code) into memory while running an automation that may only require two or three of the modules. The parent module would purely be for packaging and easy installation via PowerShellGet.
I'm just confused as to why
doesn't work but
Get-Module [ModuleName] -ListAvailable | Import-Module
You must be logged in to reply to this topic.