CmdID / PowerShell / Cmdlets / Get
Get-Command
Gets all commands. PowerShell reference
From the PowerShell reference
14 parameters
Alias gcm
What it does
Gets all commands. The Get-Command cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, filters, scripts, and applications. Get-Command gets the commands from PowerShell modules and commands available on your system. To get only commands that have been imported into the current session, use the ListImported parameter. Without parameters, Get-Command gets all the cmdlets, functions, and aliases installed on the computer. Get-Command * gets all types of commands, including all the non-PowerShell files in the PATH environment variable ($Env:PATH), which it lists in the Application command type. Get-Command that uses the exact name of the command, without wildcard characters, automatically imports the module that contains the command so that you can use the command immediately. To enable, disable, and configure automatic importing of modules, use the $PSModuleAutoLoadingPreference preference variable. For more information, see about_Preference_Variables. Get-Command gets its data directly from the command code, unlike Get-Help, which gets its information from help topics. Starting in Windows PowerShell 5.0, results of the Get-Command cmdlet display a Version column by default. A new Version property has been added to the CommandInfo class.
Get-Command [-Verb <String[]>] [-Noun <String[]>] [-Module <String[]>] [-FullyQualifiedModule <ModuleSpecification[]>] [-TotalCount <Int32>] [-Syntax] [-ShowCommandInfo] [[-ArgumentList] <Object[]>] [-All] [-ListImported] [-ParameterName <String[]>] [-ParameterType <PSTypeName[]>] [<CommonParameters>]Get-Command [[-Name] <String[]>] [-Module <String[]>] [-FullyQualifiedModule <ModuleSpecification[]>] [-CommandType <CommandTypes>] [-TotalCount <Int32>] [-Syntax] [-ShowCommandInfo] [[-ArgumentList] <Object[]>] [-All] [-ListImported] [-ParameterName <String[]>] [-ParameterType <PSTypeName[]>] [<CommonParameters>]
Get cmdlets, functions, and aliases
Get-CommandIdentifyGet commands in the current session
Get-Command -ListImportedIdentifyGet cmdlets and display them in order
Get-Command -Type Cmdlet | Sort-Object -Property Noun | Format-Table -GroupBy NounIdentifyGet commands in a module
Get-Command -Module Microsoft.PowerShell.Security, Microsoft.PowerShell.UtilityIdentifyGet information about a cmdlet
Get-Command Get-AppLockerPolicyIdentifyGet the syntax of a cmdlet
Get-Command -Name Get-ChildItem -Args Cert: -SyntaxIdentifyGet dynamic parameters
function Get-DynamicParameters
{
param ($Cmdlet, $PSDrive)
(Get-Command -Name $Cmdlet -ArgumentList $PSDrive).ParameterSets |
ForEach-Object {$_.Parameters} |
Where-Object { $_.IsDynamic } |
Select-Object -Property Name -Unique
}
Get-DynamicParameters -Cmdlet Get-ChildItem -PSDrive Cert:IdentifyGet all commands of all types
Get-Command *IdentifyGet cmdlets by using a parameter name and type
Get-Command -ParameterName Auth -ParameterType AuthenticationMechanismIdentifyGet an alias
Get-Command -Name dirIdentifyIts page in the reference: Get-Command.
Parameters
-AllIndicates that this cmdlet gets all commands, including commands of the same type that have the same name. By default, Get-Command gets only the commands that run when you type the command name.
For more information about the order that PowerShell searches for commands, see
about_Command_Precedence. For information about
module-qualified command names and running commands that don't run by default because of a name
conflict, see about_Modules.
This parameter was introduced in Windows PowerShell 3.0.
In Windows PowerShell 2.0, Get-Command gets all commands by default.-ArgumentListSpecifies an array of arguments. This cmdlet gets information about a cmdlet or function when it's used with the specified parameters ("arguments"). The alias for ArgumentList is Args.
To detect dynamic parameters that are available only when certain other parameters are used, set the value of ArgumentList to the parameters that trigger the dynamic parameters.
To detect the dynamic parameters that a provider adds to a cmdlet, set the value of the ArgumentList parameter to a path in the provider drive, such as WSMan:, HKLM:, or Cert:. When the command is a PowerShell provider cmdlet, enter only one path in each command. The provider cmdlets return only the dynamic parameters for the first path the value of ArgumentList. For information about the provider cmdlets, see about_Providers.-CommandTypeSpecifies the types of commands that this cmdlet gets. Enter one or more command types. Use CommandType or its alias, Type. By default, Get-Command gets all cmdlets, functions, and aliases.
The acceptable values for this parameter are:
- Alias: Gets the aliases of all PowerShell commands. For more information, see about_Aliases.
- All: Gets all command types. This parameter value is the equivalent of Get-Command *.
- Application: Searches folders in the $Env:PATH environment variable for non-PowerShell
executable files. On Windows, executable files have a file extension that is listed in the
$Env:PATHEXT environment variable. For more information, see
about_Environment_Variables.
- Cmdlet: Gets all cmdlets.
- ExternalScript: Gets all .ps1 files in the paths listed in the PATH environment variable ($Env:PATH).
- Filter and Function: Gets all PowerShell advanced and simple functions and filters.
- Script: Gets all scriptblocks. To get PowerShell scripts (.ps1 files), use the ExternalScript value.
- Workflow: Gets all workflows. For more information about workflows, see Introducing Windows PowerShell Workflow.
These values are defined as a flag-based enumeration. …-FullyQualifiedModuleThe value can be a module name or a full module specification. PowerShell searches the PSModulePath for the specified module.
A module specification is a hashtable that has the following keys.
- ModuleName - Required Specifies the module name.
- GUID - Optional Specifies the GUID of the module.
- It's also Required to specify at least one of the three below keys.
- ModuleVersion - Specifies a minimum acceptable version of the module.
- MaximumVersion - Specifies the maximum acceptable version of the module.
- RequiredVersion - Specifies an exact, required version of the module. You can't use this with
the other Version keys.
You can't specify the FullyQualifiedModule parameter in the same command as a Module parameter. The two parameters are mutually exclusive.-ListImportedIndicates that this cmdlet gets only commands in the current session.
Starting in PowerShell 3.0, by default, Get-Command gets all installed commands, including, but not limited to, the commands in the current session. In PowerShell 2.0, it gets only commands in the current session.
This parameter was introduced in Windows PowerShell 3.0.-ModuleSpecifies an array of modules. This cmdlet gets the commands that came from the specified modules or snap-ins. Enter the names of modules or snap-ins.
This parameter takes string values, but the value of this parameter can also be a PSModuleInfo
or PSSnapinInfo object, such as the objects that the Get-Module, Get-PSSnapin, and
Import-PSSession cmdlets return.
You can refer to this parameter by its name, Module, or by its alias, PSSnapin. The parameter name that you choose has no effect on the command output.-NameSpecifies an array of names. This cmdlet gets only commands that have the specified name. Enter a name or name pattern. Wildcard characters are permitted.
To get commands that have the same name, use the All parameter. When two commands have the same name, by default, Get-Command gets the command that runs when you type the command name.-NounSpecifies an array of command nouns. This cmdlet gets commands, which include cmdlets, functions, and aliases, that have names that include the specified noun. Enter one or more nouns or noun patterns. Wildcard characters are permitted.-ParameterNameSpecifies an array of parameter names. This cmdlet gets commands in the session that have the specified parameters. Enter parameter names or parameter aliases. Wildcard characters are supported.
The ParameterName and ParameterType parameters search only commands in the current session.
This parameter was introduced in Windows PowerShell 3.0.-ParameterTypeSpecifies an array of parameter names. This cmdlet gets commands in the session that have parameters of the specified type. Enter the full name or partial name of a parameter type. Wildcard characters are supported.
The ParameterName and ParameterType parameters search only commands in the current session.
This parameter was introduced in Windows PowerShell 3.0.-ShowCommandInfoIndicates that this cmdlet displays command information.
This parameter was introduced in Windows PowerShell 5.0.-SyntaxIndicates that this cmdlet gets only the following specified data about the command:
- Aliases. Gets the standard name.
- Cmdlets. Gets the syntax.
- Functions and filters. Gets the function definition.
- Scripts and applications or files. Gets the path and filename.-TotalCountSpecifies the number of commands to get. You can use this parameter to limit the output of a command.-VerbSpecifies an array of command verbs. This cmdlet gets commands, which include cmdlets, functions, and aliases, that have names that include the specified verb. Enter one or more verbs or verb patterns. Wildcard characters are permitted.