powershellpowershell-7

PSCommandNotFoundSuggestion message shows without suggestions (PowerShell 7.5)


I recently upgraded to PowerShell 7.5, where PSCommandNotFoundSuggestion has become a mainstream feature.

Often, after running a successful command I see the message...

Suggestion [4,General]: The most similar commands are:

... followed by no suggestions.

I wouldn't expect this message to display given that a) the original command was found, and b) no suggestions were found.

My question is: How can I fix this behaviour, or disable this feature?

I believe in PowerShell 7.4 you could use Disable-ExperimentalFeature PSCommandNotFoundSuggestion (see here). However, since PSCommandNotFoundSuggestion is now a mainstream feature this method doesn't seem to work any more.


Solution

  • You're seeing a bug, which the powers that be - unfortunately - decided not to fix:

    For now (except by default in 7.6 preview versions), avoiding the bug requires explicitly enabling the PSFeedbackProvider experimental feature as follows:

    # Start a new session afterwards for the change to take effect.
    Enable-ExperimentalFeature PSFeedbackProvider
    

    Note that there is no way to disable the PSCommandNotFoundSuggestion feature that I'm aware of.