Is this normal Powershell behavior?
Can anyone else recreate these symptoms?
I've created a module (PS 4.0) that has been revised multiple times. The problem is that if I run the command show-command from a new PS shell without first running import-module -Module name or get-command -Module Name then old command
names appear (don'tknow whwere they are coming from some form of cache?). New command names are simply refused.
If you run the command get-module -listavailable the exported commands shown were the old command names.
If i remove the module, as you would expect, no commands are shown.
Eventually to fix the problem in the .psd1 file I changed functions to export value from "*" to a subset of commands '*-ic*'. The new commands now show up in show command (although non-exported commands also show). Once again get-command -module
name lists only the exported commands. After running get-command show-command correctly shows only the exported commands. Changing the .psd1 file back to "*" show-command only shows the subset of commands until running get-command -module Name. Until
running the get-command -module Name (or command name that was available in both versions) the new PS Shell only seems to recognize what is available in the show-command.
It seems to me that show-command is obtaining its command list differently to get-command.
Is it just me or is there a trick to getting a module to update the available commands using .psd1 manifest files?
In the end I have stopped using .psd1 files as updating modules requires the use of the import-module command within the script. I am simply using the convention of naming the psm1 file to match the module folder.