Home Datacenter Power disguised as command line – 10 reasons SysAdmins should learn PowerShell scripting

Power disguised as command line – 10 reasons SysAdmins should learn PowerShell scripting

by Philip Sellers

I’m a big proponent of learning PowerShell as an administrator, engineer or any other practitioner role. And I think you should learn it.  It is the path to the future.

  1. The pipeline.  I’ve written a blog post in my head many times about the PowerShell pipeline.  I think it is the single feature that makes PowerShell powerful.  No, Microsoft didn’t invent the pipeline and I know I’ll be chastised by *nix admins (ooo we had it first), but the pipeline really does make PowerShell incredibly effective.  Once you have a data set, you can easily send it into another command where it accepts and makes changes based on that data.  Get-this | Do-that.  Its that simple!
  2. Data Objects.  Even non-developers have encountered object oriented programming at one time or another.  Objects exist to encapsulate, define and allow data to be easily manipulated.  Objects are well formed and defined.  You can explore them and find out more about your data.  Objects are mini packages and inside the package are many tools to manipulate the data.
  3. Time.  Doing things in PowerShell will save you lots of time.  If you are repeating a task, it is easy to find a command to retrieve a list of data – whether its mailboxes, accounts, computers, servers, etc. – that you need to change and then pipe it over to another command and make the change you need.  Why click 500 times when you can do it in 30 characters in PowerShell?
  4. Extensibility.  You can DIY til your heart desires.  You’re not constrained to a list of executable files and built in paramters in PowerShell.  If you find something lacking or missing, you can easily change the data in an object, scope it down, and change it to meet your needs.    And you’re not alone.  PowerShell has a thriving community of DIY-ers, many of whom freely contribute their scripts and ideas online.
  5. It is Friendly.  Learning scripting in VBscript, C#, or many other languages require you to really dig in and learn a language.  PowerShell isn’t that way.  You don’t have to learn a lot of complex syntax to begin using PowerShell.  From the first time you launch PowerShell,  For the most part things make a lot of sense and you can pickup the language quickly (but I won’t mention formatting numbers, for instance).
  6. Break the GUI glass. Sometimes you run up against a problem in the Windows management tools where you can’t export or get to the data you really want from the GUI.  PowerShell gives you access to many repositories of information you’d work much harder to access with other tools.  Not only this, PowerShell includes a wide range of formatting commands to take data objects and output them quickly, easily and simply in CSV, HTML, and plain text tables, lists and other views.  With simple SQL-like commands like Select, Where and Sort, you can also limit the output to exactly what you, or more like, what your manager wants to see.
  7. It is Microsoft’s future.  Microsoft has publicly stated that all future server products starting with Wave 15 (which included SharePoint 2013, Exchange 2013, etc.) would include PowerShell as the de-facto administration platform.  Any GUI environments would become secondary and may be missing some things that can be only done in PowerShell.  Don’t get left behind by not adopting PowerShell.  Not only is it Microsoft’s future, but automation is a big part of the future of IT.  PowerShell gives you an effective way to automate.
  8. Its what *nix geeks always wanted.  For years, Unix and Linux admins griped at all the things missing from Windows and how abysmal the command line was in Windows.  Microsoft took all those complaints off the table with PowerShell.  It is a very powerful and capable environment to perform lots of work quickly.  My *nix counterparts have always raved about having MAN pages for everything.  PowerShell also has its version of MAN pages using the Get-Help command to explore other commands and find out parameters and options for each one, including examples.  Going even further than *nix, PowerShell also includes tools like Get-Method to help you discover the functionality hidden in objects.
  9. You can join your Devs and commit your script to Git.  Ok, so I joke a bit, but many time Devs look down on administrators – aka server jockeys – because they are the ones who create the code.  Once you learn proficiency in scripting PowerShell, don’t be afraid to share with the community and start committing your scripts to Git and public repositories for others to use.  That’s how the community grows and learns from one another.  Don’t only be a taker – be a giver, too…  As a byproduct, you may understand your developers a little better, too.
  10. Its not just Microsoft…  Many other vendors have adopted PowerShell for scripting against their tools.  I’ve written a lot (including a book) about PowerCLI, which is VMware’s PowerShell environment.  What is great about third-party support is the ability to leverage everything you already know about the base PowerShell and combine it with specific commands for a particular product.  The same goes for Microsoft’s specific modules for its server products.  Once you adopt PowerShell for Active Directory and Exchange, it is a natural extension to use it for SharePoint and Lync (Skype for Business).

Now, how to you learn?

You may also like