Introduction to Get Command in PowerShell
Windows PowerShell is a scripting language that is built on .net platform designed to automate the tasks related to windows application and administration. The term PowerShell is a combination of the language and the interface in which the commands/scripts will be run. The first version of PowerShell was introduced in the year 2006. There are two types of interface where can PowerShell commands can be run; windows PowerShell is like a command prompt where PowerShell cmdlets can be run, and Windows PowerShell ISE is where PowerShell scripts (a compilation of PowerShell cmdlets) can be run and debugged. It is an object-oriented language thereby allowing it to integrate with .net interfaces. It is now open-source and can be installed on another OS’s as well.
To start a PowerShell session, type “PowerShell” in command prompt.
PowerShell cmdlets and variables
The commands in PowerShell are referred to as “cmdlets”. The most important of all cmdlets is the Get-Command. This cmdlet returns the list of all available cmdlets in PowerShell.
The following is the syntax of the Get-Command cmdlet.
[[-Name] <String>] [-Module <String>] [-FullyQualifiedModule <ModuleSpecification>] [-CommandType <CommandTypes>] [-TotalCount <Int32>] [-Syntax] [-ShowCommandInfo] [[-ArgumentList] <Object>] [-All] [-ListImported] [-ParameterName <String>] [-ParameterType <PSTypeName>] [-UseFuzzyMatching] [<CommonParameters>]
To fetch the cmdlets that are available in the current session, the following cmdlet can be used.
Parameters of Get-Command in PowerShell
Here are the following parameters of Get-Command in PowerShell mention below
4.5 (2,920 ratings)
All: This denotes that all the cmdlets need to be retrieved. Its type is the switch parameter. The default value is none and it doesn’t accept wild card characters.
ArgumentList: This is used to retrieve information about the cmdlets with the help of specified parameters. Its type is of the object. Alias is Args. The default value is none and doesn’t accept wild characters.
CommandType: This denotes the types of commands that are returned by the cmdlet. Some of its values are Alias, All, Application, External Script, Filter and Function. Its type is command type and aliases is Type. The default value is none and doesn’t accept wild card characters.
FullyQualifiedModule: Returns the cmdlets that are with the specified module names. Its type is module specification. The default value is none and doesn’t accept wild card characters.
ListImported: Returns cmdlets that are present in the current session. Its type is the switch parameter. The default value is none and doesn’t accept wild card characters.
Module: Returns the cmdlet that is available in the specified module. Type is string, the default value is none and accepts wild card characters.
Name: This returns the list of mentioned cmdlets with the specified names. Wild card characters are allowed. Type is string, the default value is none.
Noun: Returns the cmdlets, functions, and aliases that contain the same noun or nouns as specified. Its type is a string and the default value is none. Accept wild card characters.
ParameterName: Returns the cmdlets in the current session with the specified parameters. Its type is string, the default value is none and doesn’t accept wild card characters.
ParameterType: Returns the cmdlets in the session that have the same parameter as the specified type. Its type is PStypename. The default value is none and doesn’t accept wild card characters.
TotalCount: Denotes the total number of cmdlets to be returned. The type is Int32. The default value is none and does not accept wild card characters.
Verb: Returns the cmdlets, functions, and aliases that contain the same verb or verbs as specified. Its type is a string and the default value is none. Accept wild card characters.
Examples of Get command
Here are the Examples of Get command in PowerShell mention below
Get cmdlets in the current session
Get cmdlets inside the specified module
Get-Command -Module Microsoft.PowerShell.Management
Find the cmdlets that an output type
Get-Command -Type Cmdlet | Where-Object OutputType | Format-List -Property Name, OutputType
Conclusion – Get command in PowerShell
Thus, the article covered in detail about the Get-command cmdlet in Powershell. For detailed information, it is advisable to use the Get-Help command for get-command.
This is a guide to Get command in PowerShell. Here we discuss the Parameters and Examples of Get command in PowerShell along with input and output. You may also look at the following article to learn more –