Structure and Naming
Module
Modules can be used to package and distribute cohesive libraries of functions that perform common tasks. Typically, the names of these functions share one or more nouns that reflect the common task that they are used for. These functions can also be similar to .NET Framework classes in that they can have public and private members. For example, a library can contain a set of functions for file transfers. In this case, the noun reflecting the common task might be “file.”
Modules can be used to customize your environment by adding specific cmdlets, providers, functions, and variables.
Cmdlet
A cmdlet is a lightweight command that is used in the Windows PowerShell environment. Cmdlets perform an action and typically return a Microsoft .NET Framework object to the next command in the pipeline.
Cmdlets differ from commands in other command-shell environments in the following ways:
Cmdlets are instances of .NET Framework classes; they are not stand-alone executables.
Cmdlets can be created from as few as a dozen lines of code.
Cmdlets do not generally do their own parsing, error presentation, or output formatting. Parsing, error presentation, and output formatting are handled by the Windows PowerShell runtime.
Cmdlets process input objects from the pipeline rather than from streams of text, and cmdlets typically deliver objects as output to the pipeline.
Cmdlets are record-oriented because they process a single object at a time.
A cmdlet, which is expressed as a verb-noun pair, has a .ps1 extension. Each cmdlet has a help file that can be accessed by typing Get-Help <cmdlet-Name> -Detailed. The detailed view of the cmdlet help file includes a description of the cmdlet, the command syntax, descriptions of the parameters and an example that demonstrate the use of the cmdlet.
Command structure
Every command in PowerShell is composed of 2 parts:
Do something-To something
Verb-Noun # Get-Help, Get-Command, Get-Service, Set-Service, etc.
Verb # Add,Clear,Copy,Enter,Exit,Get,Join,Move,Push,Remove,Set etc.
-Noun # Service,Command,Content,Date,Event,Process etc.
You can see a list of all available verbs online or with bellow cmdlet:
Get-Verb
Shows all available verbs
Get-Verb -Verb s*
Shows only verbs that starts with s
Aliases
Some cmdlets have also aliases that are similar to unix-like commands.
You can get a lit of aliases:
Get-Alias
Last updated