Hide VSCode warning for PSUseApprovedVerbs

#VSCode #PowerShell #Windows #MacOS

I use VSCode for all my coding. One thing I appreciate about the PowerShell module in VSCode is how it recommends best practices inline with my script.

One of the recommended best practices for PowerShell is to use a list of approved verbs that define which words can be used in functions. This makes sense—I love the way PowerShell uses the Verb-Noun structure to keep things standardized and avoid confusion.

Sometimes the recommended list of verbs doesn't include what I'm trying to do, like “Check” or “Verify”. When I write a function using an unapproved verb, VSCode puts an orange squiggly line and these alerts get counted with others that I would consider more important:

This makes my VSCode environment noisy and it can be difficult to sift through all the alerts to try to identify real issues. After some digging, I found a way to hide these alerts without turning off the whole PSScriptAnalyzer feature.

Note: In the code examples, I've removed the signature blocks. Don't change or delete this section in your environment—If you do, you'll need to re-install the PowerShell extension and/or VSCode.

Windows

On Windows, the configuration file for this feature is located at C:\Users\USERNAME\.vscode\extensions\ms-vscode.powershell-2025.0.0\examples\PSScriptAnalyzerSettings.psd1

Open the file and move the PSUseApprovedVerbs from IncludeRules into the ExcludeRules section.

Here is my updated PSScriptAnalyzerSettings.psd1 file:

@{
    # ...
    IncludeRules = @('PSAvoidDefaultValueSwitchParameter',
                     'PSMisleadingBacktick',
                     'PSMissingModuleManifestField',
                     'PSReservedCmdletChar',
                     'PSReservedParams',
                     'PSShouldProcess',
                     'PSAvoidUsingCmdletAliases',
                     'PSUseDeclaredVarsMoreThanAssignments')

    # ...
    ExcludeRules = @('PSUseApprovedVerbs')
    # ...
}

MacOS

On MacOS, the configuration file is here: /Users/USERNAME/.vscode/extensions/ms-vscode.powershell-2025.0.0/modules/PSScriptAnalyzer/1.23.0/Settings/CmdletDesign.psd1

Note: Your module version might be different, so verify you have the correct path.

Comment out the 'PSUseApprovedVerbs' word like this:

@{
    IncludeRules=@( #'PSUseApprovedVerbs',
                   'PSReservedCmdletChar',
                   'PSReservedParams',
                   'PSShouldProcess',
                   'PSUseShouldProcessForStateChangingFunctions',
                   'PSUseSingularNouns',
                   'PSMissingModuleManifestField',
                   'PSAvoidDefaultValueSwitchParameter')
}
# ...

Conclusion

After updating the file, restart VSCode. This should prevent that pesky popup and the alerts from appearing.

Footer image

Discuss...