What is Windows PowerShell?

  • What is it for?
  • How do I use it?
  • How is it different from the regular Command Prompt?
  • Is there anything I should know before starting to use it?
  • Any awesome things you can do with it that a super user should know about?

Solution 1:

Taken from Wikipedia http://en.wikipedia.org/wiki/Windows_PowerShell

Windows PowerShell is an extensible command-line shell and associated scripting language from Microsoft. It was released in 2006 and is currently available for Windows XP SP2/SP3, Windows Server 2003, Windows Vista, and is included in Windows Server 2008 as an optional feature. Windows PowerShell 2.0 was released with Windows 7 and Windows Server 2008 R2. It is going to be backported to previous supported platforms Windows XP SP3, Windows Server 2003 SP2, Windows Vista SP1 and Windows Server 2008.4

Windows PowerShell integrates with the Microsoft .NET Framework and provides an environment to perform administrative tasks by execution of cmdlets (pronounced commandlets), which are specialized .NET classes implementing a particular operation; scripts, which are compositions of cmdlets along with imperative logic; executables, which are standalone applications; or by instantiating regular .NET classes.5 These work by accessing data in different data stores, like the filesystem or registry, which are made available to the PowerShell runtime via Windows PowerShell providers.

Windows PowerShell also provides a hosting mechanism with which the Windows PowerShell runtime can be embedded inside other applications, which can then leverage Windows PowerShell functionality to implement certain operations, including those exposed via the graphical interface. This capability has been utilized by Microsoft Exchange Server 20075 to expose its management functionality as PowerShell cmdlets and providers and implement the graphical management tools as PowerShell hosts which invoke the necessary cmdlets. Other Microsoft applications including Microsoft SQL Server 20088 also expose their management interface via PowerShell cmdlets. In the future, graphical interface-based management applications on Windows will be layered on top of Windows PowerShell.

Windows PowerShell includes its own extensive, console-based help, reminiscent of man pages in Unix shells via the Get-Help cmdlet.

Searching Stackoverflow using this search I've found the following:

  • What is Windows PowerShell?
  • How to get started with PowerShell?
  • How do you use PowerShell?
  • PowerShell Tips & Tricks for Developers

Again on serverfault using this search I've found the following:

  • Powershell? Do you use it? Show me some cool sysadmin things i can do with it?
  • What are some good resources for learning PowerShell scripting?
  • What’s your favorite Powershell command or script for system administration?
  • Common PowerShell Pitfalls

Solution 2:

The "Great Powershell Heresy", a.k.a. greatest innovation of PS over the UNIX-style shells you may be familiar with (tcsh, bash, etc.) is this:

Pipelines in "all those other shells" pass strings around. Pipelines in PowerShell pass objects around.

Because of this, PowerShell might be "harder" to learn, i.e. it requires learning new technology, and doing detailed stuff requires more knowledge of what's going on... but, once learned, it is VASTLY simpler to write shell scripts that can actually be read by other people (or you, 5 years later)... and those scripts are far less likely to "break" when something else on the system is changed.