Get basic information about PowerShell commands: cmdlets, files and functions.
Syntax
Get-Command [-noun string[ ]] [-verb string[]]
[[-argumentList] Object[]] [-totalCount int]
[-Module string[]] [-syntax] [CommonParameters]
Get-Command [[-name] string[]] [[-argumentList] Object[]]
[-commandType {CommandTypes}] [-totalCount int]
[-Module string[]] [-syntax] [CommonParameters]
key
-name
Get information for cmdlets (or command elements) with this name.
All or part of the name, wildcards are permitted.
-verb
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".
-noun
Get information for cmdlet names that include the specified noun.
"process", "Service", "Variable" etc. Wildcards are permitted:"*item*"
-commandType CommandTypes
Get only specified types of command objects:
Alias Powershell Alias
All
Application All non-PowerShell files in the PowerShell path.
Cmdlet Powershell Cmdlet (default)
ExternalScript
Filter All PowerShell functions
Functon All PowerShell functions
Script
You can use -CommandType or its alias, -Type.
-totalCount int
Count the number of items retrieved.
-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.
-syntax
Describes the item:
alias name, cmdlet syntax, function definition, filter definition,
script path/filename.
-argumentList
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.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
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.
Examples
Describe the 'Set' verbs:
PS C:\> get-command -verb set | format-list
PS C:\> get-command -verb set | format list *
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
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:
Get-Help - Open the help file
Get-PSDrive - Get drive information (DriveInfo)
Get-Member - Enumerate the properties of an object
Equivalent bash command: man - Display helpful information about commands.
© Copyright SS64.com 1999-2013
Some rights reserved