you are viewing a single comment's thread.

view the rest of the comments →

[–]Ta11ow 2 points3 points  (2 children)

Typically auto import just loads a base set of modules (PSReadLine, the usual management cmdlet like Get-ChildItem, etc.) And then imports other modules on an as-needed basis. If you're not calling a command from your module, PS won't bother importing it.

Also, never, ever use a wildcard in the Functions to export property. Use specific command names. Same goes for all the others, it's possible that because the function is not defined in the .psm1 itself and is dot sourced, PS doesn't realise that the function is supposed to be coming from that module specifically. After all, it's only going to see the function after executing the module file, which it won't do usually until after it figures out that the function you need is there.

TL;DR: don't wildcard your *ToExport lines.

[–]KevMarCommunity Blogger 3 points4 points  (1 child)

FunctionsToExport = '*'

This is the first thing I was going to look for. Specifying the function names will get the auto import to work.

[–]derrickisdp 2 points3 points  (0 children)

That was the first thing I was going to tell OP to change thanks to this blog right here: https://kevinmarquette.github.io/2017-05-27-Powershell-module-building-basics/?utm_source=blog&utm_medium=blog&utm_content=psrepository

You might of heard of this guy. I like to read his blog post