Smoother and closer touch by Powershell

Background

After Microsoft told the world about the desire to Linux, Windows Powershell became shared to the world like Linux did,

also supported cross-platform since 2016, which is the task automation and configuration management framework,

with unique command-line shell and scripting language. There are some classic shells still widely used in Linux.

Some of the Linux or open-source fans may laugh at what Windows try to compact with Linux and even MacOS.

However, Powershell is further improvement version from history with modern IT view by many intelligent experts,

actually for some admin tasks it always can give much sharper solutions than the old-school UNIX shells.

Design

From official, Windows PowerShell can execute four kinds of named commands:

  • cmdlets:
    command-lets are .NET programs followed Verb-Noun naming pattern, receive/emit objects through pipeline
  • PowerShell scripts:
    chain of commands to execute which pipeline objects can be passed, secured by execution policy
  • PowerShell functions:
    a grouping of code that handle input and return output, advanced functions can create “script cmdlets
  • Standalone executable programs:
    launches it in a separate process, as usual as the standard way

Benefits

  1. Cross-platform:
    general set of commands which are fitted for both Windows, Linux, MacOS, that one shell is needed to learn only
  2. Structured-object data:
    optimized for dealing with structured data (e.g. JSON, CSV, XML, etc.), REST APIs, and object models
  3. Humanized language:
    comprehensible cmdlets and syntax closed to human thinking and logic, powerful auto-completion with help

There is no doubt that the new Powershell is a time evolution shell interface for human to talk with computer.

However, it still needs time to develop and grow up to become an universal IT standard in real, it made a good start!

Syntax

The common use of powershell is shown below.

The image may be small to display, then drag the image to new tab to lookup.

ps-cheatsheet

Comments