Author Posts

February 1, 2016 at 8:35 am

I have a rather large custom module that I've made available on github. I've had a few requests to extract the functions into individual .PS1 files that are then loaded by the .PSM1 file. Is this something that can be handled via telling the manifest to include/import all .PS1 files located in specific folders, or will I need to put the logic for dot-sourcing the PS1 files into the .PSM1 file?

February 1, 2016 at 8:50 am

I tend to dot-source. Particularly for the scenario you describe (just load everything in the folder), it's easier to just use Get-ChildItem and a foreach loop.

February 1, 2016 at 9:23 am

You could also create a manifest for the module, and have it import all of them when the module is loaded. But, as Dave implies, you have to explicitly list them all – there's no so much a wildcard option that way.

February 1, 2016 at 10:35 am

Thanks, guys. So until manifests are able to accept wildcards, sounds like I'll be sticking with dot-sourcing. Cheers.