A cmdlet is a lightweight command that is used in the Windows PowerShell environment.
Verb-Noun -Parameter Value -SwitchParameter
Commands always begin with a command name, such as New-Alias. Type the command name or its alias, such a “gcm” for Get-Command.
The parameters of a command are options that determine what the command does. Some parameters take a “value,” which is user input to the command.
For example, the Get-Help command has a Name parameter that lets you specify the name of the topic for which help is displayed. The topic name is the value of the Name parameter.
In a Windows PowerShell command, parameter names always begin with a hyphen. The hyphen tells Windows PowerShell that the item in the command is a parameter name.
For example, to use the Name parameter of New-Alias, you type the following:
A parameter value is the input that the parameter takes. Because Windows PowerShell is based on the Microsoft .NET Framework, parameter values are represented in the syntax diagram by their .NET type.
For example, the Name parameter of Get-Help takes a String value, which is a text string, such as a single word or multiple words enclosed in quotation marks.
PowerShell cmdlets have a Verb-Noun syntax, which can be seen above. The important thing to note is that the noun is always singular even though the cmdlet might return more than one result.
Here, syntax is capitalized for readability, but Windows PowerShell is case-insensitive.
To see a list of legal verbs in PowerShell you can use the Get-Verb cmdlet.
Knowing and understanding legal verbs and keeping in mind the singular noun rule will assist you in guessing cmdlet names.
For example, suppose you want to get a list of services and their status – that’s right, its as easy as
How do you think we would get a list of running processes – Atta Boy! 😀 that’s right
Powershell Cmdlet’s facilitates a platform to work upon multiple technologies. For example, install Active Directory modules in your powerhsell and check users and groups on the fly.
Include the exchange module and check mailboxes and other attributes.
Powershell comes with this cool feature, which will make your life damn easy. Aliases provide you multiple ways to run the same commands.
For example, You want to get list of items present in current directory, you could run the command
Or, you could simply type and run the command gci which is an alias for Get-ChildItem.
Some of the aliases are just like Linux commands like , ls which is again an alias for Get-ChildItem
Happy Learning !