Improving Module Auto-loading

by Nov 22, 2013

PowerShell 3.0 will auto-load modules as you have seen in a previous tip. However, with some modules, this technique may fail. Their cmdlets will still only be available after you manually import the module using Import-Module.

The reason most likely is the way these modules were built. PowerShell has no way of detecting which cmdlets are exported by these modules.

Still, one simple line may help and make even more modules available automatically:

The -Refresh switch parameter tells PowerShell to thoroughly look at all the modules available and build or refresh an internal command cache.

Twitter This Tip! ReTweet this Tip!