Powershell & cmdlet - In a Nutshell - Part 1 - Introduction


                    Le Café Central de
Deva              

                                 
                                 ..... Deva blogs!!




 

 

Powershell & cmdlet - In a Nutshell - Part 1 - Introduction

  • Comments 2

What is a PowerShell?

Windows PowerShell or Powershell or Windows Shell is a new Windows command-line shell (includes an prompt and scripting environment, which can accept and return text) designed for specially system adminis. 

Windows Powershell Vs. Classic Shell(s):

  • Windows PowerShell does not process text. Instead, it processes objects based on the .NET platform.
  • Windows PowerShell comes with a large set of built-in commands with a consistent interface.
  • All shell commands use the same command parser, instead of different parsers for each tool. This makes it much easier to learn how to use each command.

New feature?

PowerShell uses its own scripting language, rather than reusing existing languages, for the following reasons.

  • Windows PowerShell needed a language for managing.NET objects.
  • The language needed to provide a consistent environment for using cmdlets.
  • The language needed to support complex tasks, without making simple tasks more complex.
  • The language needed to be consistent with higher-level languages used in .NET programming, such as C#.

Advantages:

It is built on top of the .NET common language runtime (CLR) and the .NET Framework, and accepts and returns .NET objects.

  • This fundamental change in the environment brings entirely new tools and methods to the management and configuration of Windows.
  • It gives you access to the file system on the computer easily.
  • So Windows PowerShell providers enable you to access other data stores, like the registry & digital signature certificate stores.
  • Windows PowerShell introduces cmdlet, a single-function command-line tool built into the shell.
    • We can use each cmdlet separately
    • But cmdlet power can be realized when you use these simple tools in combination to perform complex tasks.
    • It have more than 100 basic core cmdlets, and you can write your own cmdlets and share them with other users.

Pipeline operator:

The Pipeline operator helps to pass the output of one command to another command as input. In Powershell-cmdlet it receives an object can act directly on its properties and methods without any conversion or manipulation. So that users can refer to properties and methods of the object by name, rather than calculating the position of the data in the output.

  • The pipeline operator (|) sends the result of the command on its left to the command on its right.

What can we work with Powershell?

  • Can run Windows command-line programs
  • Can open GUI programs like Notepad, Calculator
  • Can capture the text that the Windows programs generate and also make use of that values in Powershell

For example,

"c:\> ipconfig | select-string  -pattern 255"

where,
- "ipconfig" command-line program, which will provide Windows IP configuration details
- "select-string -pattern 255" cmdlet to manipulate to find the text pattern "255" in the Ipconfig output

Page 1 of 1 (2 items)
Blog - Post Feedback Form(CAPTCHA)
Leave a Comment
  • Post