Get basic information about PowerShell commands: cmdlets, files and functions.

      Get-Command [-Noun String[] ]  [-Verb String[] ] [[-ArgumentList] Object[] ]
          [-All] [-ListImported] [-Module String[] ] [-FullyQualifiedModule ModuleSpecification[]]
             [-ParameterName String[] ] [-ParameterType PSTypeName[] ]  [-ShowCommandInfo]
                [-Syntax] [-TotalCount Int32 ] [ CommonParameters]

      Get-Command [[-Name] String[] ]  [-CommandType CommandTypes ] [[-ArgumentList] Object[] ]
          [-All] [-ListImported] [-Module String[] ] [-FullyQualifiedModule ModuleSpecification[]]
             [-ParameterName String[] ] [-ParameterType PSTypeName[] ] [-ShowCommandInfo]
                [-Syntax] [-TotalCount Int32 ] [-UseFuzzyMatching] [-UseAbbreviationExpansion] [ CommonParameters]
       Get all commands, including commands of the same type that have the same name.
       By default, only returns the command that would run if you typed the command name.
       PowerShell 3.0+  (In PowerShell 2.0, Get-Command gets all commands by default.)

       Get information about a cmdlet when it is used with a specific argument,
       such as a file path or a registry key. e.g., "HKML\Software" or "cert:\my".
       This is useful because some cmdlet parameters are added dynamically.

       Get information for cmdlets (or command elements) with this name.
       All or part of the name, wildcards are permitted.
       Get information for cmdlet names that include the specified verb.
       String  "Get", "Set", "Remove" etc.  Wildcards are permitted and multiple
       verbs or verb patterns can be specified: "*et".
       Get information for cmdlet names that include the specified noun.
       "process", "Service", "Variable" etc. Wildcards are permitted:"*item*"
   -commandType CommandTypes
       Get only specified type(s) of command objects:

             Alias              PowerShell Alias
             Application        Non-PowerShell files in the PowerShell path.
             Cmdlet             PowerShell Cmdlet (default)
             ExternalScript     .ps1 script files in the Path ($env:path).
             Filter             PowerShell functions.
             Functon            PowerShell functions.
             Script             Script blocks built into the runspace config.
             Workflow           Workflows.
       You can use -CommandType or its alias, -Type.
   -totalCount int32
       Limit the number of items retrieved.

       Get only commands in the current session.
       Beginning 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, only commands in the current session are returned.

   -Module string[]
       Get the commands that came from the specified modules or snap-ins.
       Enter the names of modules or snap-ins, or enter snap-in/module object name(s).

       You can use -Module, or its alias, -PSSnapin.

       This parameter takes string values, or a PSModuleInfo or PSSnapinInfo object, such as the 
       objects returned by Get-Module, Get-PSSnapin, and Import-PSSession.

       Specifies modules with names that are specified in the form of ModuleSpecification objects,
       described in the Remarks section of ModuleSpecification Constructor (Hashtable).

       For example, the FullyQualifiedModule parameter accepts a module name that is specified in one of
       the following formats:     @{ModuleName = "modulename"; ModuleVersion = "version_number"}
                                  @{ModuleName = "modulename"; ModuleVersion = "version_number"; Guid = "GUID"}
       ModuleName and ModuleVersion are required, but Guid is optional.

       You cannot specify the -FullyQualifiedModule parameter in the same command as a -Module parameter.
       The two parameters are mutually exclusive.

   -ParameterName String
       Get commands in the session that have the specified parameters.
       Enter parameter names and/or parameter aliases. Wildcard are supported.
       The -ParameterName and -ParameterType parameters search only commands in the current session.
       PowerShell 3.0+ 

   -ParameterType PSTypeName[]
       Get commands in the session that have parameters of the specified type.
       Enter the full name or partial name of a parameter type. Wildcards are supported.
       The ParameterName and ParameterType parameters search only commands in the current session.
       PowerShell 3.0+ 

       Indicates that this cmdlet displays command information. This parameter was introduced in Windows PowerShell 5.0.

       Describes the item:
       alias name, cmdlet syntax, function definition, filter definition,
       script path/filename.

       Indicates using matching of the characters in the command to find with uppercase characters in a command.
       For example, i-psdf would match Import-PowerShellDataFile as each of the characters to find matches an
       uppercase character in the result. When using this type of match, any wildcards will result in no matches.

       Indicates using a fuzzy matching algorithm when finding commands.
       The order of the output is from closest match to least likely match. Wildcards should not be used with fuzzy matching
       as it will attempt to match commands that may contain those wildcard characters.

Standard Aliases for Get-Command: gcm

Get-Command gets its data directly from the code of a cmdlet, function, script, or alias, unlike Get-Help, which gets its information from help topic files.

The -Module parameter will find the commands added to the session by adding a PowerShell snap-in or importing a module.

To list commands with the same -name in execution order, type the command name without wildcard characters.


Describe the 'Set' verbs:

PS C:\> get-command -verb set | format-list
PS C:\> get-command -verb set | format list *

List all functions in the current session:

PS C:\> get-command -CommandType function

Display cmdlets in noun-based groups:

PS C:\> get-command | sort-object noun | format-table -group noun

Display all Active Directory cmdlets available to PowerShell:

PS C:\> get-command -module ActiveDirectory -verb get
PS C:\> get-command -module ActiveDirectory -noun ADUser

List all the parameter aliases available for a cmdlet (Get-CimInstance):

PS C:\> Get-Command Get-CimInstance | % Parameters | % Values | Select Name, Aliases

Retrieve information about all the elements available to PowerShell (all files, functions, aliases and cmdlets):

PS C:\> get-command *

Describe the alias 'dir':

PS C:\> get-command dir | format-list

Klinger: "Oh, you were built for command. Those shoulders -- broad enough for four stars. That height-- commanders should be tall--to look down on his men"
Corporal: "Napoleon didn’t do so bad" ~ Dialogue from M*A*S*H 1978

Related PowerShell Cmdlets

Get-Alias - Return alias names for Cmdlets.
Get-Help - Open the help file.
Get-PSDrive - Get drive information (DriveInfo).
Get-Member - Enumerate the properties of an object.
Get-StartApps - Get the names and AppIDs of installed apps.
Equivalent bash command: man - Display helpful information about commands.

Copyright © 1999-2024
Some rights reserved