Author : MD TAREQ HASSAN | Updated : 2021/09/09
PowerShell (PowerShell Core) vs Windows PowerShell
PowerShell | Windows PowerShell |
---|---|
It’s Open Source “PowerShell Core” | Windows PowerShell (1.0 - 5.1) is a component of the Windows OS |
Cross-platform | Windows only |
PowerShell Core is released under the MIT license | Windows licensing |
PowerShell is a distinct set of tools and components that is shipped, installed, and configured separately | Included in Windows |
Built on top of .Net Core | Windows PowerShell 5.1 is built on top of the .NET Framework v4.5 |
More: https://docs.microsoft.com/en-us/powershell/scripting/whats-new/differences-from-windows-powershell
cmdlet
- A cmdlet is a lightweight command that is used in the PowerShell environment
- Commands for PowerShell are known as cmdlets. Cmdlets are native PowerShell commands. In addition to cmdlets, PowerShell allows you to run any command available on your system
- Cmdlets are collected into PowerShell modules that can be loaded on demand
- Cmdlets can be written in any compiled .NET language or in the PowerShell scripting language itself
- A cmdlet is a single command that participates in the pipeline semantics of PowerShell. This includes binary (C#) cmdlets, advanced script functions, CDXML, and Workflows.
- Cmdlets perform an action and typically return a Microsoft .NET object to the next command in the pipeline
- The PowerShell runtime invokes these cmdlets within the context of automation scripts that are provided at the command line (also invokes them programmatically through PowerShell APIs)
Pipeline
- Pipeline is a command chain in which output of one command goes to next command as input
-
A pipeline is a series of commands connected by pipeline operators ( ) (ASCII 124) - Each pipeline operator sends the results of the preceding command to the next command.
- The output of the first command can be sent for processing as input to the second command, and so on…
- Details: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_pipelines
Command syntax
- PowerShell uses a Verb-Noun name pair to name cmdlets
- The verb identifies the action that the cmdlet performs
- the noun identifies the resource on which the cmdlet performs its action
- Example:
Get-Xxx
,Set-Xxx
cmdlet info
#
# Get-Command cmdlet included in PowerShell is used to get all the cmdlets that are registered in the command shell
#
Get-Command # get all commands available
Get-Command -Noun <xyz> # get all commands that has <xyz> in it
Get-Command -Noun "Variable"
#
# Getting help about cmdlet
#
# Get-Help <cmdlet-name>
#
Get-Help Start-Service -Full
Get-Help Start-Service -Parameter *