what are Powershell's advantages over cygwin/unix-shell

There is an excellent answer from Jeffrey Snover (the PowerShell designer) on StackOverflow:

https://stackoverflow.com/questions/573623/#573861


The most obvious advantage: As long as no text output (or a legacy command) is involved in a pipeline, you are not moving text through the pipes, but instances of .NET framework objects, with all their properties and methods.

This allows for a more expressive and less ambiguous pipeline handling that also is completely uninfluenced by locale and language settings (for example, think of date or number formats and how you'd have to treat them as strings normally).

This also means that you have access to a great deal of the .NET framework capabilities in a scripting environment.


Without going into value judgements about the paradigm the principal advantages of PowerShell are .Net integration and incumbency - from Windows 2008 server onwards it is bundled by default and it is loaded in service packs on 2003 and 2003 R2.

To be fair, there are several other choices for scripting - for example Perl and Python. Python also gives you the option of using IronPython if you want native .Net integration. In fact, IronPython will install satisfactorily by just dropping it in a directory. You can trivially bundle it in an application with no need for a separate installation step.

Powershell's key strength is a bit of a double-edged sword. While streaming .net objects is quite useful and has its advantages, it places a lot more assumptions on the ability of the components to play nicely with the framework. For this to really work you need to wrap things with cmdlets. While textual output is somewhat more low level and requires parsing, it places less burden on the components to play nicely with the framework.

Over time, I would expect to see much more of the Windows ecosystem (both MS and third-party components) come with cmdlet wrappers so they work with Powershell. As this happens the case for Powershell will become much stronger.

Historically, one of the key traditional weaknesses of Windows from administrative perspective has been its poor scripting support. MS recognized this a number of years ago and after a few lame attempts (e.g. WSH) Powershell is MS's most credible effort so far to fix that deficiency.


I think the biggest win for powershell is that you can pipe anything to anything without having to parse text and/or grok sed and awk. Without bringing those nasty objects into the equasion, think of powershell as having automatic sed and awk for linking commands in a pipeline.