9
votes

The obvious difference I'm aware of, is the ability to interface to certain MS products, such as Exchange. But for one not having to administer such products, what are the advantages of Powershell? What are the reasons to learn Powershell at all (assuming I'm fluent with bash and cygwin)?

6 Answers 6

2
votes

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

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

18
votes

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.

6
votes

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.

2
votes

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.

2
votes

Advantages:-

  1. Automation of Tasks :- Tasks such as adding a user to 1000 machines is a tedious job manually. But with the help of powershell, you need to write just a simple script and that script is run, it will automatically configure all the clients. Thus it saves the time by repeating the steps automatically. Windows PowerShell backup\restore scripts can be developed and scheduled (with Windows Task Scheduler), whereas Central Administration is used for single-use backups and restores. Windows PowerShell has the advantage of running against SQL snapshots instead of the production database. One of the parameters of the Windows PowerShell command will cause a SQL snapshot to be generated, and then Windows PowerShell will run the action against the snapshot instead of the production database. This will reduce the resource impact of the backup operation on the production environment. With Windows PowerShell, SharePoint administrators will have more granular control of options for the backup or restore.

  2. Improvement in remoting capabilities:- The significance is twofold, firstly, the Windows 7 desktops can communicate with the server using PowerShell commands. As a result techies with Windows 7 laptops can configure their servers remotely by running PowerShell scripts. Secondly, client logon scripts written in PowerShell, which reside on the server, can run on Windows 7 more easily. Also using powershell, we can easily control the remote machines, can perform important tasks on them and can easily apply these changes on a large scale. Remoting uses the network resources. So when we would be working with powershell, we are not using the GUI and hence, the bandwidth required for a certain task is reduced and network overloading problem is solved.

  3. Consistency:- If you have a set procedure for completing a task, using Windows Powershell will make sure you never miss a step, automate as much as you can, and have Powershell prompt you for the stuff that can't be automated.

  4. .NET Support:- Powershell supports the .NET framework. Therefore all the system functions can be easily added to the powershell scripts and thus is an aid to the programmer in developing the scripts. Thus automating the tasks of VDI is much easier , simpler and efficient.

  5. Less manual work:- Administrator can now create, delete or modify the settings of Virtual machines remotely by just writing the scripts. He has no need to go to the individual pc and get the work done. Also scripts written are acceptable on all the computers. So the administrator has no need to rewrite them again and again.

  6. Reusability:- The scripts once written to perform a specific task can be stored for later purposes and also can be combined with other scripts to perform different tasks. So repetitive tasks can be performed in a much simpler manner by just running the scripts. This saves the administrators time and money in configuring the machines.

  7. Pipelining support:- The biggest win for powershell is that you can pipe anything to anything without having to parse text. You can provide the output of one command as an input to the new set and thus can solve the complex tasks.

0
votes

Cygwin is not guaranteed to be available for every version of Windows. Last I checked it was questionable on 64 bit machines. Powershell is becoming the default command shell for windows, and will offer "native" access to all resources on a Windows machine.

1
  • I use cygwin on 64 bit Vista, works perfectly.
    – lajos
    May 24, 2009 at 3:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .