I want to import a bunch of modules at once for various scripts based on directory. For instance, if I have five modules in 'somedirectory\here\' I want a one liner to import them all.
How is this done in PowerShell? Is there something like a manifest I can make with names of all the modules in it that will help me import them all?
Also, I'm already aware of user profiles ($profile). That will not work as a solution in this case.
Well, add this one liner to the beginning of a script, change the path to where you desire the files to be loaded and all is set.
To load the module (PSM1) files only
'G:\sync\Office\*.psm1' | gci | Import-Module
To load modules (PSM1) and scripts (PS1)
'G:\sync\Office\*' | gci -include '*.psm1','*.ps1' | Import-Module
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With