diff --git a/reference/7.6/Microsoft.PowerShell.Core/Get-Command.md b/reference/7.6/Microsoft.PowerShell.Core/Get-Command.md index ed0e7a18de7e..a6c8f660e398 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/Get-Command.md +++ b/reference/7.6/Microsoft.PowerShell.Core/Get-Command.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 11/09/2024 +ms.date: 01/17/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/get-command?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: Get-Command @@ -17,20 +17,20 @@ Gets all commands. ### CmdletSet (Default) ``` -Get-Command [-Verb ] [-Noun ] [-Module ] - [-FullyQualifiedModule ] [-TotalCount ] [-Syntax] [-ShowCommandInfo] - [[-ArgumentList] ] [-All] [-ListImported] [-ParameterName ] - [-ParameterType ] [] +Get-Command [[-ArgumentList] ] [-Verb ] [-Noun ] + [-Module ] [-ExcludeModule ] [-FullyQualifiedModule ] + [-TotalCount ] [-Syntax] [-ShowCommandInfo] [-All] [-ListImported] + [-ParameterName ] [-ParameterType ] [] ``` ### AllCommandSet ``` -Get-Command [[-Name] ] [-Module ] - [-FullyQualifiedModule ] [-CommandType ] [-TotalCount ] - [-Syntax] [-ShowCommandInfo] [[-ArgumentList] ] [-All] [-ListImported] - [-ParameterName ] [-ParameterType ] [-UseFuzzyMatching] - [-FuzzyMinimumDistance ] [-UseAbbreviationExpansion] [] +Get-Command [[-Name] ] [[-ArgumentList] ] [-Module ] + [-ExcludeModule ] [-FullyQualifiedModule ] + [-CommandType ] [-TotalCount ] [-Syntax] [-ShowCommandInfo] [-All] + [-ListImported] [-ParameterName ] [-ParameterType ] [-UseFuzzyMatching] + [-FuzzyMinimumDistance ] [-UseAbbreviationExpansion] [] ``` ## DESCRIPTION @@ -324,6 +324,18 @@ Application getconf 0.0.0.0 /usr/bin/getconf Application command 0.0.0.0 /usr/bin/command ``` +### Example 17: Exclude modules from the search for commands + +The following example shows the difference in results of searching for commands in all modules and +when you exclude a specific module. + +```powershell +PS> (Get-Command *-*Disk*).Count +73 +PS> (Get-Command *-*Disk* -ExcludeModule Storage).Count +35 +``` + ## PARAMETERS ### -All @@ -425,6 +437,22 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### ExcludeModule + +Specify the name of one or more modules to be excluded from the search. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: ByValue (False), ByName (False) +Accept wildcard characters: False +``` + ### -FullyQualifiedModule The value can be a module name, a full module specification, or a path to a module file.