A light introduction to PowerShell, the first ever .NET based scripting language
Just like most of beginners, my first encounter with UNIX was a daunting
experience. Before that, my perception of an operating system was based on
windows. Frankly speaking, at that point of time, I hated the command based
approach of UNIX. And throughout my training in my company, UNIX classes always
remained in a mess. But later I came to know the advantages of command-based
approach & Scripting skills.
most of the people think COMMAND.COM and cmd.exe as twins of UNIX command
shells. They include only a handful of basic commands, and most people easily
conclude that shells & scripting in windows is awkward as compare to UNIX.
that’s not true Guys! In the past, MS attempted to come up with powerful shells
& scripting engines, such as ‘Windows Script Host’ (WSH, type cscript.exe
at cmd), netsh & WMIC. In 2006, MS came up with ‘Windows PowerShell’ (PS).
PS introduced a brand-new, powerful, more flexible, more consistent
object-based command line tool & scripting language. It is currently
available for XP SP2/SP3, Windows 2003, and Vista; and included in WS08 as an
optional feature. The present version, PS 2.0 was released in July 2010 and
also integrated with Windows 7 and 2K8 R2. As Microsoft has stopped further
development of COM-based VBScript now, PS is the future of windows based scripting.
In the next sections of this article, we will launch PS and try out some basic commands
(in PS they call commands as cmdlets).
if you are having Windows 7 (or 2008 or R2), you can launch PS by typing ‘powershell’
in Run (Win+R) or through All Programs -> Accessories -> Windows
PowerShell. For XP/Vista, you can download it from Microsoft sites. Once the PS
console launched, you will get a screen similar to below one:
You can use almost all (read not all) your old cmd commands on PS Console, although the output may be different. Try out few basic commands like Date, dir on PS Console and compare the output with cmd outputs. Now, an obvious question from any beginner, why a new shell and new scripting language? Is VBScript and cmd were not enough? The answer is no! May be the first look is not enough to justify the answer. The most striking feature of PS is that it is based on .NET framework. Surprised? Yes, you can use all the power and potential of .NET in PS scripts. You can even make windows form!! But the primary target users of PS are system admins, Server App Users. In the next articles, we will discuss more about PowerShell and will make the traditional ‘Hello World’ script.