Avatar of Erwin Pombett
Erwin Pombett
Flag for Switzerland asked on

in powershell, can we have several .psm1 files for a module ?

Hello,

I'm writing some powershell. In order to get things cleaner i decided to write my code in modules.
So far i always work the same way :

1. I create a folder inside C:\Program Files\WindowsPowerShell\Modules\
2. I create a file with the same name as the folder in inside.
3. I invoke the create manifest file command.
4. I reference the psm1 - file with code - in the psd1.

question:
how can i add more psm1 files inside a module.

thank you in advance.

Erwin .
PowershellOutlook

Avatar of undefined
Last Comment
Guy Lidbetter

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Guy Lidbetter

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Erwin Pombett

ASKER
Hello Guy Lidbetter,

thank you for your answer.

yes ! that's my necessity ;) i dont want to create a single psm1 per module and i was wondering if we could add more on the RootModule configuration variable but you answered to my question.

*** Question :
Do this means that by removing the module and importing it,  all code in files : the one referenced by the configuration variable Rootmodule and also those under Nested modules will be refresh ?

Thank you in advance for this last info.
Guy Lidbetter

If you update ANY of the modules in the nest, or the manifest you would have to manually reload the module (PSD1) in order to use them.

Regards

Guy
Your help has saved me hundreds of hours of internet surfing.
fblack61