PowerShell

PowerShell_Core_6.0_icon

 

PowerShell is a task-based command-line shell and scripting language designed especially for system administration.

PowerShell is built on the .NET Framework and preloaded into Windows, so there is no fee or additional licensing cost.

 

Microsoft provides PowerShell support for almost all Windows Server roles and features.

You can use PowerShell to automate repeated tasks as well as perform tasks easily using the command line that you usually perform using the GUI tools.

PowerShell providers let you access data stores, such as the registry and certificate store, as easily as you access the file system.

PowerShell has a rich expression parser and a fully developed scripting language.

PowerShell includes its own extensive, console-based help (similar to man pages in Unix shells) accessible via the Get-Help cmdlet.

Cmdlets

Cmdlets are specialized commands in the PowerShell environment that implement specific functions. Cmdlets follow a Verb-Noun naming pattern, such as Get-ChildItem, helping to make them self-descriptive.

Some of the verbs use for you to learn PowerShell is:

  • Get — To get something
  • Start — To run something
  • Out — To output something
  • Stop — To stop something that is running
  • Set — To define something
  • New — To create something

Cmdlets output their results as objects and can also receive objects as input, making them suitable for use as recipients in a pipeline.

If a cmdlet outputs multiple objects, each object in the collection is passed down through the entire pipeline before the next object is processed.

Pipeline

PowerShell implements the concept of a pipeline, which enables piping the output of one cmdlet to another cmdlet as input.

Scripting

Windows PowerShell includes a dynamically typed scripting language which can implement complex operations using cmdlets imperatively.

The scripting language supports variables, functions, branching (if-then-else), loops (while, do, for, and foreach), structured error/exception handling and closures/lambda expressions, as well as integration with .NET.

Scripts written using PowerShell can be made to persist across sessions in either a .ps1 file or a .psm1 file.

  • PS1 – Windows PowerShell shell script
  • PSM1 – Windows PowerShell module file

 

Concepts :