Wednesday 30 July 2014

Concept Of Powershell

What is PowerShell?
PowerShell is a new command shell and scripting language for Windows. It is cool for a lot of reasons: The language is sane, especially when compared to CMD. Scripts and command line share a language.

Why PowerShell:
  1. PowerShell is both a command-line shell and scripting language.
  2. PowerShell can interact with a dizzying number of technologies.
  3. PowerShell is object-based.
  4. PowerShell can help anyone working in the Microsoft ecosystem
  5. Microsoft is putting its full weight behind PowerShell.
How we Use PowerShell?

PS1 file
PS1 files are a bunch of PowerShell command in which a command appears in different line. It is a simple text file in which extension must be .ps


Execution permissions
As we know it is a series of command so, it must be have some permission and execution policy to prevent wrong commands. Also you can set policy as per user request. There are four types of policies namely Restricted, RemoteSigned, AllSigned, Unrestricted.


Running a script
To run the shell script you can go to the PS1 file path and type name of PS1 file and press tab key to Execute.

Pipelining
Pipelining means output of one command use as input to next command.

Variables
Store the output of command we need a variable so we can declared variable also. To declared variable use '$' Sign.

The @ symbol
'@' symbol is use for convert contains of list into an array. This is useful for storing multiple values.

Split
Split is used for splitting a string. Suppose we need to store a string into an array in that case we use split function.

About Author:
Vishal Kudale  is enthusiast .net developer who works as associate consultant with Systems Plus Pvt. Ltd. He in free time reads and write on various web technologies. He can be contacted at: vishal.kudale@spluspl.com

6 comments:

  1. Really very useful coding stuff thanks Vishal for Sharing this

    ReplyDelete
  2. m currently learning host configuration things, so if have anything related to it kindly push forward. BTW good article vishal, hopefully it will be usefull for all .... :)

    ReplyDelete
  3. 1. MS cmd is not that handy. I would prefer cygwin or mingw over powershell. Install cygwin and use the full power of shell.
    2. You can use pipeline, inline command execution(back ticks), input/output redirection and other powerful shell commands. Which are still lacking in cmd or powershell.
    3. Looks like MS cmd is still catching up on these features. Going forward It would be great if MS implements rich feature set of shell.
    Btwn Nice Article :)

    ReplyDelete
    Replies
    1. Thanks for information..
      will soon post about Cygwin.

      Delete