Saturday, 5 July 2014

Basic understandings about Windows PowerShell.

My goal with this post is to start from beginning and try to give some basic idea about PowerShell. This is not a comprehensive session..

Windows PowerShell is a task automation and object oriented management engine based on .NET Framework which is designed especially for system administration and automate batch processing. PS is Object Oriented, but that doesn't mean you have to become a programmer to use it. PS is an extendable command shell as well.

What is Powershell ???

CMDLETS : Cmdlets are the native powershell commands in powershell environment. Cmdlet follows a Verb-Noun naming system with self-descriptive. Example : get-help

PIPE LINE (|) OR (¦) : Windows powershell pipeline takes the output from one command and sends it as an input of another command. In simple word, pipeline combines commands, filtering and giving the required output.

EXTENDABLE : This means, we can add values to this environment by extending it with our own commands (cmdlets).

Miss understandings of PS :
Powershell is NOT just a simple scripting language
And NOT just an advanced CMD Prompt.

PowerShell Versions

PS 1.0 : Released in 2006 for Windows XP SP2, Windows Server 2003 and Windows Vista.
PS 2.0 : Released in 2009 and Integrated with Windows-7 and Windows Server 2008R2
PS 3.0 : Released in 2012 and Integrated with Windows-8 and Windows Server 2012. Available for Windows-7 as well
PS 4.0 : Released in 2013 with new featured like Desired state configuration etc:
PS 5.0 : Released in 2013 with new features like class definition etc:

How to Use Powershell ?

Powershell engine is a set of .Net framework classes stored in a DLL file. You can not interact with it directly.
When we talk about "Using Powershell" we are most often talking about using it through a host that looks like command-line.  Microsoft provides two host for that purpose..

Console and ISE (Integrated Scripting Environment).

Console(PowerShell.exe) is an application that runs in command line and ISE is basically a graphical powershell application which is using for scripting purpose and we can have different run-space in a single window to run multiple scripts.Power GUI and SAPIEN PS Editor are the examples of some other third party host which enables more features.

Powershell and old command prompt (cmd) use the same underlying console technology, which means that you can type powershell in command prompt and cmd in powershell to switch the other shell. Exit will revert back the starting shell.

What is 64-Bit and 32-Bit Console ?

This is basically pointing to powershell extensions. If you are loading an extension, you can only load which is built on the same architecture. The 64-Bit shell can only load 64-Bit extension. And if you have 32-Bit extension you have to load 32-Bit shell.

Is Powershell available in all the OS by default ?

No. Windows Powershell is not available in all Operating system by default. It is available from Windows 7 and its latest and from windows-2008 R2 and its latest.We can download and install powershell in Windows-XP, Windows-Vista and Windows-2003. PowerShell version 5.0 is the latest release from Microsoft.

Why Should we learn PowerShell ?

  • Believe it or not, As per my experience from past one year using the command line made my life easier. Which meas that, I completed a task which required 6 hours in 10 Minutes by writing scripts. :) 
  • Almost all the latest products from Microsoft can be manageable by using powershell, like System Center Products, Active Directory, Exchange Server, SQL, Share Point Etc :
  • As we all know, there is a big competition for new IT jobs that are available. Therefore  its better if you can list Windows Powershell among your skill set.