Art of Automation: Leveraging PowerShell to Improve Your Business


imagePowerShell is a key technology that hopefully you have in your business’ tool belt to help your customers.   Especially with the evolution your customers experiencing as you help the modernize their data center.  Whether it is helping them to continue on-premises or transition them to the cloud.  PowerShell can help offer consistent service and performance for you and your customers. 

Even though PowerShell is in its 5th version, talking with partners it still seems to carry this aura of complexity, mystery and mystique.  While PowerShell can perform many complex tasks, the language can be easy to learn.  Learning this language will allow you to unlock the complexities of PowerShell to help you assist your customers.  Let’s begin with what is PowerShell

What is PowerShell?

PowerShell is Microsoft’s is not just scripting language but is also a highly interactive shell.  You will find PowerShell in all of products from XBOX to Azure and many in between.  PowerShell may be a command-line tool, but Windows PowerShell can accomplish all of the tasks that graphic management tools can—and often more quickly and easily, and with less intervention from you.   Like most scripting languages PowerShell is suited for performing repetitive bulk operations in a consistent fashion.   Windows PowerShell is not a text-based shell, but instead uses an object model based on the Microsoft .NET platform.  Sometimes it is affectionately referred to as .NET on the command line!

Why should you care?

There a few reasons why PowerShell can help you and your business:

  1. Microsoft Partner Competency:  Many of the Microsoft Partner Competency levels  require certification.  PowerShell is key technology in a majority of the recent certification exams from datacenter to cloud based tests.
  2. Allows you to create unique IP service offerings for your company to offer to customers.  Allow you an opportunity to differentiate from your competitors.
  3. PowerShell is the scripting language of choice.  PowerShell scripts are typically not only be shorter but also easier to write and not as picky, and for lack of a better word, more PowerFull.

At the end of the day, this is a language that can help save you time effort and hopefully headaches.  at the end you will find many uses for PowerShell in your environment!

Reading the Language

imageThe language is designed to be easy to read and understand.  It is common language based which makes it easy to read.  All you need is a little bit of a grammar lesson to start down the path.    For instance when you look at this PowerShell example:

Get-Service -Name NetLogon –RequiredServices

Much like we break down a sentence in any language to verb (action), noun (object), or adjective (descriptions) we can break PowerShell down into this common syntax as well.  When you take a closer look at the second example (Get-Service -Name NetLogon –RequiredServices) you should be able to see the components:

  • Get = Verb
  • Service = Noun (Objects)
  • -Name = Adjective (officially known as a parameter)

So just like a sentence you perform actions with your objects, and if you need more specifics you can add parameters to learn more, organize output or filter the results.  All of your commands will follow this base structure and these commands are all highly “reverse engineer-able”.  For example, in the example, you saw how to find the required services for the NetLogon service, what if you wanted to learn the required services for another service, simple just replace the name of the service.  This is an important basic principle for all PowerShell scripts and commands.  Additionally, the great thing about the majority of the verbs in PowerShell is that they are common across the various different objects you will work with.  Most of the verbs functions are obvious, start, stop, recover, write, remove…etc.  Most of the nouns/objects are in common terms as well, service, process, ADobject...etc.   One of the more common verbs you will use is Get.  This verb is the general all-purpose informational verb; you want to learn about services or process it will start with Get.  In the next post, I will talk more about how to get all the commands available in your PowerShell session, btw the command you would use is hidden in the sentence. 

There are a couple of fun facts about the PowerShell language.  First almost all of the objects used in your PowerShell commands are singular, it is Service not Services, Process not Processes...etc.  I say almost with 99.9999% reliability.  I used to say 100% then I ran into some of the Group Policy PowerShell objects which just happen to end with a “s”.  While it is a bummer, I let it slide because I love Group Policy and quite frankly it rocks!  As you begin to learn to use PowerShell for your unique reasons you will quickly become familiar with the objects and parameters used to work with those objects, and you can avoid a lot of bad command type errors by simply dropping the “s”.

The second fun fact is how sensitive PowerShell as a language can be.  PowerShell is a sensitive language, it is most definitely, spelling and syntax sensitive.  PowerShell has very little tolerance for misspelled words in your commands or the overuse of commas, just like editors for a book.  With that said, PowerShell as a language is mostly:

CaSe InSeNsItIvE!

So when you are writing your cmdlets and scripts keep that in mind. When you are looking at help files or other forms on online documentation, it will follow a mixed case pattern with the beginning of every word in the cmdlet being capitalized. According to the documentation you would see the get-service cmdlet written officially  like this: Get-Service.  However, all three variations of this cmdlet will do exactly the same thing:

  • get-service
  • GEt-sErVIce
  • GET-SERVICE

Resources:

Here are some links to even more resources to start learning the basic of the language.  I highly recommend the Hey, Scripting Guy! Blog.  It is a great blog with tons of great information! 

ACTION ITEM:

I will be posting a few topics on how to get started with PowerShell.  Additionally will talk about how PowerShell can be leveraged in Azure and Office 365.  You can help me as well and get answer to your questions.  Is there a topic on PowerShell you would like to learn more about to help your business then comment on this post.  I look forward to your comments and suggestions and hearing from you.

In the meantime, get-PowerShelling! 

Hester_Matt-5330

Matt Hester
Sr. Partner Technology Strategist

Comments (1)

  1. Anonymous says:

    Recently I published an introductory article about how PowerShell can help transform your business. The

Skip to main content