PowerShell tutorial – beginning with PowerShell

fig : PowerShell - "Windows PowerShell ISE" - executing first CMDLET - Get-Help
fig : PowerShell - "Windows PowerShell ISE" - executing first CMDLET - Get-Help

Hi All,

Greetings for the day!!!

We are continuing PowerShell tutorial. Today we will discuss some basics about PowerShell

Take away from this article – At the end of this article you will got to know about

  • What is PowerShell
  • What are PowerShell CMDLETs
  • To whom for PowerShell
  • PowerShell features
  • Why to use PowerShell
  • PowerShell tools
  • Writing our first PowerShell – Getting started

What is PowerShell

  • Microsoft defines PowerShell – PowerShell is a cross-platform task automation solution made up of a
    • command-line shell
    • a scripting language and
    • a configuration management framework
  • PowerShell runs on Windows, Linux, and macOS
  • PowerShell is commonly used for automating the management of systems
  • PowerShell accepts and returns .NET objects. It works objects over texts
  • PowerShell is built on .NET Common Language Runtime (CLR)
  • Commands for PowerShell are known as CMDLETs(pronounced command-lets)

PowerShell CMDLETs

  • Commands for PowerShell are known as CMDLETs(pronounced command-lets)
  • PowerShell module is the collection of PowerShell CMDLETs
  • PowerShell uses a Verb-Noun name pair to name cmdlets
  • Examples
    • Get-Help – Here,
      • Verb – Get : what action needs to perform and
      • Noun – Help : resource on which CMDLET perform its actions

PowerShell features

  • Very good command-line history
  • Intellisense – Tab completion
  • Pipeline for chaining commands
  • PowerShell scripting language is extensible through functions, classes, scripts and modules
  • PowerShell scripting have built-in support for common data formats like CSV, JSON and XML
  • Easy output formatting
  • Built-in help system – Provides detailed information about commands and also integrate online help articles
  • Aliases –
    • Aliases are alternate names that can be used to run CMDLETS
    • PowerShell supports the use of common aliases such as cls (clear the screen) and ls (list the files)
    • This helps users from other frameworks and helps to remember PowerShell name for there familiar commands

To whom for PowerShell

  • Basically for all kind of administrators
  • System administrators
  • Cloud administrators (In case of Microsoft – Azure Administrator, Azure AD Administrator, SharePoint Online Administrators, Exchange Administrators and so on)
  • Developers
  • Deployment team
  • Even for QAs as well for testing purpose

Why to use PowerShell

  • To build, test and deploy the solutions and mostly in CI/CD environments
  • PowerShell helps to automate administrative tasks
  • To manage cloud – To manage cloud resources. Get / Update / Deploy – cloud resources
    • Creating users in Microsoft 365
    • Creating groups in Azure AD and so on
  • CI / CD – used as part of a Continuous Integration/Continuous Deployment pipeline
  • This list is very long, we will be keep exploring in upcoming articles of tutorial

PowerShell tools

Writing our first PowerShell – Getting started

  • We could see all PowerShell releases at – https://github.com/PowerShell/PowerShell/releases
  • There are lots of available PowerShell CMDLETs we can use or we can write script as well as per our need
  • Today as a first PowerShell CMDLET, I’ll discuss Get-Help CMDLET
  • I’ll use Windows PowerShell ISE
  • Following are the steps

STEP 1 – Choose the tool to execute CMDLET / write Script – Open the PowerShell ISE

fig : PowerShell - Opening "Windows PowerShell ISE"
fig : PowerShell – Opening “Windows PowerShell ISE”
  • As PowerShell ISE opens it looks like as below
  • There are two panes to – PowerShell ISE
    • Script Pane
    • Console
PowerShell - "Windows PowerShell ISE"
fig : PowerShell – “Windows PowerShell ISE”

Step 2 – In console window use CMDLET – Get-Help as

Get-Help 

fig : PowerShell - "Windows PowerShell ISE" - executing first CMDLET - Get-Help
fig : PowerShell – “Windows PowerShell ISE” – executing first CMDLET – Get-Help
  • Get-Help – Displays information about PowerShell commands and concepts.

fig : PowerShell - "Windows PowerShell ISE" - executing first CMDLET - Get-Help
fig : PowerShell – “Windows PowerShell ISE” – executing first CMDLET – Get-Help

REFERENCES

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: