tags:

views:

537

answers:

7

Can someone please explain what PowerShell is?

I have Windows 7 installed, and I noticed that it has PowerShell. I remember installing this a while back when signing up for Windows Azure, but only because it was required.

Can someone please explain this in uber-layman's terms? :)

+1  A: 

Microsoft Powershell is Microsoft's new commandline utility that was designed to provide greater control and flexibility to IT administrators.

You can think of it as a really complicated version of Command Prompt designed for repeatable tasks.

From Microsoft's website: "Microsoft Windows PowerShell command line shell and scripting language helps IT professionals achieve greater control and productivity. Using a new admin-focused scripting language, more than 130 standard command line tools, and consistent syntax and utilities, Windows PowerShell allows IT professionals to more easily control system administration and accelerate automation. Windows PowerShell is easy to adopt, learn, and use, because it works with your existing IT infrastructure and existing script investments, and because it runs on Windows XP, Windows Vista, and Windows Server 2003. Windows PowerShell is now included as part of Windows Server 2008 and can be evaluated in Windows Server 2008 Beta 3. Exchange Server 2007, System Center Operations Manager 2007, System Center Data Protection Manager V2, and System Center Virtual Machine Manager also leverage Windows PowerShell to improve administrator control, efficiency, and productivity."

http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

Mr. Pig
A: 

Powershell is Windows version of KornShell. It is an shell extension that allows you to control windows once again from the command line like we did way back in the day. Other than the syntax, the largest difference between Korn and Powershell is that powershell can handle Objects, while in KornShell everything had to be passed in strings.

WolfmanDragon
This all sounds cool, how can a semi-wannaBeAmatur Nerd like myself benefit from this? Can you please describe a few cool things that can be done with Powershell?
Integration with .Net assemblies, for one thing.
RobS
PowerShell is NOT a version of KornShell. PowerShell is a different type of shell. Jay's and John Cook's answer below illustrate the unique object orientation of PowerShell.
Steven Murawski
Well, I'd like to provide examples based on what you might do with scripting. Check http://blogs.msdn.com/powershell and http://www.powershellcommunity.org.
Marco Shaw
Please, for all that is good in the world, unaccept this answer.
EBGreen
@Steven, please go read the development history of Powershell. Start out at the powershell blog, and then re-read my answer. Powershell is based off of Korn shell. The Powershell team even says so. They changed the syntax and added object handling, but the core is Korn.
WolfmanDragon
I know that there is a Holy War between the Linux and Windows camps. I belong to neither, they are both just tools for me to do my job. I'm just answering the question.
WolfmanDragon
hmm, Microsoft bought SoftWay in 1999. What did SoftWay offer Microsoft?http://news.zdnet.co.uk/software/0,1000000121,2073850,00.htm
WolfmanDragon
Being based on the philosophy of Korn is by no means the same thing as being a version of korn.
EBGreen
@wolfmandragon - PowerShell draws influence from many languages and shells, but it is not a version of KornShell. PowerShell operates on a completely different paradigm than a text based shell.
Steven Murawski
Thank you Steve, I do realize this, the gentleman asked for an explanation in "uber-layman's terms". I gave the answer in uber-layman's terms".
WolfmanDragon
While I was learning powershell in 07 I read an interveiw with one of the powershell team, I don't remember which one. He said that they started with Korn and built from there. When I find the article I will give a direct quote and links.
WolfmanDragon
+3  A: 

In my opinion, the big deal is PowerShell passes around objects. It takes a while to realize just how powerful this is. For example, instead of munging the text output of a utility, looking for what you want in characters 7 through 18, you can just access a property of an object. That's much faster to use, and it's not going to break if a new version adds an extra character to the output.

John D. Cook
A: 

Here's one of the cool effects of the .NET integration / object hangling: calling webservices from the command line and handling the results as .NET objects that can be manipulated.

Eclipse
+22  A: 

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. CMD had many small but important differences. CScript and Windows Scripting Host are not interpreted.

Command line usage can be quick while scripts can be readable, thanks to the combination of aliases and smart command argument processing. For example, dir -r . is the same as Get-ChildItem -Recurse -Path "."

Consistent command argument syntax, across all cmdlets and custom scripts (in V2.0).

Powerful interaction with other technologies, most notably .NET. Also, WMI is suddenly convenient and accessible. COM is there, too. V2 makes Win32 interop easy, too.

An integrated script editor/interactive shell in V2 that is very cool.

Command pipelines work on objects, not strings, which means you don't need to parse, and you can format text for humans not the next command. In bash I did a lot of cut, but in PowerShell I don't have to. The objects are real .NET objects, which is very powerful.

Before PowerShell I managed to become an expert in CMD script writing, but now I can start erasing that part of my brain. Thank goodness.

EDIT: It's worth mentioning that lots of Microsoft products are adding PowerShell support, especially for server products. For example, Exchange ships with PowerShell cmdlets, so you can administer your Exchange server via PowerShell.

Jay Bazuzi
Excellent explanation. Where the resources that you used to learn about powershell?
Click Ok
1) Objects is a concept new for many. One should not forgot that a string is just a certain type of object. 2) Exchange 2007 is an excellent example, it doesn't just ship with PowerShell, but the entire admin UI is built *on* PowerShell. Not all Microsoft products have that level of integration.
Marco Shaw
@Click: http://msdn.microsoft.com/en-us/library/aa973757(VS.85).aspx, http://oreilly.com/catalog/9780596528492/, http://www.manning.com/payette/.
Jay Bazuzi
+1  A: 

The value of Powershell is less as a benefit for end-users, and much more as a benefit for system maintainers, because they know it will be installed on every machine that has Windows 7+.

Factor Mystic
A: 

PowerShell is Bash with more annoying syntax.

Paul Betts
Don't hate, you know it's true!
Paul Betts