About PowerShell
Latest version: PowerShell 7.0.0 (Preview)
Stable version: PowerShell 6.2.1 core and PowerShell 5.1
> PowerShell is a task-based
command-line shell and scripting language built on .NET.
> First appeared in 2006.
> It was made open-source and
cross-platform on 18 August 2016.
> Commands are object-based.
> Large set of built-in
commands.
> PowerShell core supports
many operating systems like Windows, macOS, CentOS and Ubuntu etc.
PowerShell available in two version PowerShell Core 6.x and
PowerShell 5.x
|
PowerShell 5.x
|
PowerShell Core 6.x
|
Platforms
|
Windows
only (client and server)
|
Windows,
Mac OS, Linux
|
Dependency
|
.Net
Framework
|
.Net
Core
|
EXE name
|
powershell.exe
|
pwsh.exe
|
Cmdlet
|
2000+
|
400+
|
Download
|
By
default, available in all Windows OS
|
|
PowerShell makes
it easy to discover (cmdlet)
PS C:\> Get-Command *-Service
PS C:\> Get-Help Get-Service
PS C:\> Get-Service | Get-Member
Or
PS C:\> Get-Command -All * | more
PS C:\> Get-Command -Verb * | more
PS C:\> Get-Command -Noun * | more
PS C:\> Get-Command -Module * | more
PS C:\> Get-Command -Module * | more
To break more, press Ctrl+c
PowerShell
Syntax
In PowerShell commands (often
called cmdlets) have the form:
verb-noun
that is a verb indicating the action
and a noun indicating the object for
Example:
Get-Service
New-Service
Restart-Service
Resume-Service
Set-Service
Start-Service
Stop-Service
Suspend-Service
PowerShell
Module
A module is a package that
contains PowerShell commands, such as cmdlets, providers, functions, workflows,
variables, and aliases.
People who write commands can use
modules to organize their commands and share them with others. People who
receive modules can add the commands in the modules to their PowerShell
sessions and use them just like the built-in commands.
Examples
Get modules imported into the
current session
PS C:\> Get-Module
Get installed modules and
available modules
PS C:\> Get-Module –ListAvailable
Get all exported files
PS C:\> Get-Module -ListAvailable –All
Get
all installed modules
PS C:\> Get-InstalledModule
Finds
a module in the default repository
PS C:\> Find-Module -Name PSWindowsUpdate
Find
modules with similar names
PS C:\> Find-Module -Name *WindowsUpdate*
View the default module locations
PS C:\> $env:PSModulePath