Skip to content

Commit 312fc0e

Browse files
committed
Add ExcludeModule parameter to Get-Command
1 parent bbd443d commit 312fc0e

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

reference/7.6/Microsoft.PowerShell.Core/Get-Command.md

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: System.Management.Automation.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Core
5-
ms.date: 11/09/2024
5+
ms.date: 01/17/2025
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/get-command?view=powershell-7.6&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Get-Command
@@ -17,20 +17,20 @@ Gets all commands.
1717
### CmdletSet (Default)
1818

1919
```
20-
Get-Command [-Verb <String[]>] [-Noun <String[]>] [-Module <String[]>]
21-
[-FullyQualifiedModule <ModuleSpecification[]>] [-TotalCount <Int32>] [-Syntax] [-ShowCommandInfo]
22-
[[-ArgumentList] <Object[]>] [-All] [-ListImported] [-ParameterName <String[]>]
23-
[-ParameterType <PSTypeName[]>] [<CommonParameters>]
20+
Get-Command [[-ArgumentList] <Object[]>] [-Verb <string[]>] [-Noun <string[]>]
21+
[-Module <string[]>] [-ExcludeModule <string[]>] [-FullyQualifiedModule <ModuleSpecification[]>]
22+
[-TotalCount <int>] [-Syntax] [-ShowCommandInfo] [-All] [-ListImported]
23+
[-ParameterName <string[]>] [-ParameterType <PSTypeName[]>] [<CommonParameters>]
2424
```
2525

2626
### AllCommandSet
2727

2828
```
29-
Get-Command [[-Name] <String[]>] [-Module <String[]>]
30-
[-FullyQualifiedModule <ModuleSpecification[]>] [-CommandType <CommandTypes>] [-TotalCount <Int32>]
31-
[-Syntax] [-ShowCommandInfo] [[-ArgumentList] <Object[]>] [-All] [-ListImported]
32-
[-ParameterName <String[]>] [-ParameterType <PSTypeName[]>] [-UseFuzzyMatching]
33-
[-FuzzyMinimumDistance <UInt32>] [-UseAbbreviationExpansion] [<CommonParameters>]
29+
Get-Command [[-Name] <string[]>] [[-ArgumentList] <Object[]>] [-Module <string[]>]
30+
[-ExcludeModule <string[]>] [-FullyQualifiedModule <ModuleSpecification[]>]
31+
[-CommandType <CommandTypes>] [-TotalCount <int>] [-Syntax] [-ShowCommandInfo] [-All]
32+
[-ListImported] [-ParameterName <string[]>] [-ParameterType <PSTypeName[]>] [-UseFuzzyMatching]
33+
[-FuzzyMinimumDistance <uint>] [-UseAbbreviationExpansion] [<CommonParameters>]
3434
```
3535

3636
## DESCRIPTION
@@ -324,6 +324,18 @@ Application getconf 0.0.0.0 /usr/bin/getconf
324324
Application command 0.0.0.0 /usr/bin/command
325325
```
326326

327+
### Example 17: Exclude modules from the search for commands
328+
329+
The following example shows the difference in results of searching for commands in all modules and
330+
when you exclude a specific module.
331+
332+
```powershell
333+
PS> (Get-Command *-*Disk*).Count
334+
73
335+
PS> (Get-Command *-*Disk* -ExcludeModule Storage).Count
336+
35
337+
```
338+
327339
## PARAMETERS
328340

329341
### -All
@@ -425,6 +437,22 @@ Accept pipeline input: True (ByPropertyName)
425437
Accept wildcard characters: False
426438
```
427439

440+
### ExcludeModule
441+
442+
Specify the name of one or more modules to be excluded from the search.
443+
444+
```yaml
445+
Type: System.String[]
446+
Parameter Sets: (All)
447+
Aliases:
448+
449+
Required: False
450+
Position: Named
451+
Default value: None
452+
Accept pipeline input: ByValue (False), ByName (False)
453+
Accept wildcard characters: False
454+
```
455+
428456
### -FullyQualifiedModule
429457

430458
The value can be a module name, a full module specification, or a path to a module file.

0 commit comments

Comments
 (0)