Wednesday 27 July 2016

5 Awesome Benefits of PowerShell

Jeffrey Snover, Microsoft. Inventor of PowerShell
If you thought that the command line had been confined to history, think again. There’s a not-so-new kid on the block that is getting a lot of attention. It’s called PowerShell, and was first released with Windows 7 and Windows Server 2008 R2. The latest release, version 5.0, will be included in Windows Server 2016 which is currently in technical preview.

PowerShell is a scripting language that is designed to automate server tasks. It can run interactively or in scripts, and is super useful for all sorts of things. It was a ground-up redesign, and has a refreshing elegance to it.

First, a few basics. PowerShell is based on .Net classes and is implemented using cmdlets. A cmdlet has a verb-noun syntax that is designed to be descriptive, and as far as is possible, intuitive. Examples of cmdlets are get-help and get-command.

Cmdlets are organized into modules, with each module containing cmdlets for a particular product. There is a SQL Server module, an Azure module, and an Active Directory module, plus many, many more. Modules are either loaded, or unloaded.

But why would you use PowerShell rather than the GUI? There are a number of awesome benefits:
  1. A PowerShell script is testable. Once developed, it can be tested and signed off to say it does what it says on the tin.
  2. A PowerShell script is repeatable. It may be quick to do something once using the GUI, but it is slow and error-prone to do it many times.
  3. A PowerShell script can be saved. For tasks that are not done very often, or need to be done by different people, having a script ensures that the job gets done in the same way every time.
  4. You can do more with PowerShell. Not everything is built into the GUI, so PowerShell lets you do more stuff than is pre-built into the GUI.
  5. PowerShell is less exciting than the GUI. If you’ve got complex changes to put into production, PowerShell takes much of the risk out of the deployment. You can test the scripts multiple times, and in different situations. You can be sure that the script does exactly what is intended, without any variation. And even if it is run at 3am, it will do exactly what it was intended to do. So much less exciting than hoping it is all going to go OK.
As the move to the cloud is gaining momentum, and Microsoft Azure is increasing in popularity, PowerShell is proving its worth. It is ideal for working with Azure, enabling resources to be commissioned or removed easily.
 
But perhaps the most awesome aspect of PowerShell is its irrepressible inventor, Jeffrey Snover. With his bulging wardrobe of bright ties and impish grin, you would think he had just invented ice cream. Maybe he has – the Windows version of it anyway.

No comments:

Post a Comment