I have a personal module with a bunch of commonly use functions. Since I can never remember the syntax for loading the PowerCLI modules or how to silently connect to vCenter instance (without all the yellow error messages), I thought I would write a function to do it all for me. I see the function just fine (my module auto-loads and I can get-help on my function), but the modules seem to fall out of scope after the function completes, so they are not available to me to start using PowerCLI commands in my PowerShell session. I don't want PowerCLI to load every time I start ISE since it takes long to load and connect - I only want them available at specific times and hence I thought a could use a function to automate the process.
Is there a way to load modules that exist during the entire PowerShell session from a function called from a module? Or for that matter, why can't PowerCLI auto-load like every other module?
Thanks
NK