Daily tasks that require manual developer intervention are ticking time bombs: all it takes is one missed check on the wrong day, and you can have major problems.
Recently, I found myself responsible for a system that needed to be monitored carefully so the team could be notified in case of failure. I developed a PowerShell solution that did the work for me, saving time and ensuring we had a much safer system. PowerShell is a truly powerful scripting language. Here are three reasons you should learn it:
It’s an Easy Language to Learn
Initially, PowerShell scripts can look complex, but they are not. PowerShell uses “cmdlets,” small programs with a “verb-noun” naming convention that make the scripts easy to read and logical to understand. For example, the cmdlet:
- Get-Process will do exactly what you would expect: get a list of all processes for the local machine.
- Get-Service will provide a list of all services for the local machine.
- Send-Mail Message will send an email based on the parameters provided.
These are just a few cmdlets, but PowerShell has thousands more not to mention that there are PowerShell extensions that provide even more cmdlets for specific applications such as Microsoft Exchange or Azure. PowerShell supports aliases (alternate names for cmdlets), and a number of basic Unix commands are provided to help provide a familiar environment and simplify the learning curve.
You Get Your Time Back
Doing cinematography as a hobby, I realized that there are a lot repetitive tasks I have to do after each production event, such as transferring video files from memory cards onto a workstation and archiving final video files to a server. Tough, but not super-difficult tasks, they can be tedious and time consuming. However, a simple PowerShell script can make this processes more efficient. For example, when inserting the memory card into the computer, we can initiate a PowerShell script that will automatically start transferring files from the memory card to folders on the computer based on when the video files were created.
Similarly, when I’m done with a video project, I can save the final file into a folder and have a PowerShell script check the contents of that folder every hour and migrate those files to a server. After such development I can simply plug in my memory card and go to lunch. After finishing my project, I can go do something else and know that my project files will be archived automatically. This is the power that PowerShell provides.
You Can Automate Tasks and Save Money
PowerShell is powerful enough to save you money. How? Many admins are already using this technology to save companies hundreds of dollars per month, especially for businesses that are using cloud technologies and Azure or AWS. Most businesses don’t utilize resources (VMs, servers, databases, etc.) on the weekends, but pay to keep those cloud services running. For systems that aren’t required to be online 24/7, you can write a simple PowerShell script to automatically turn off those servers on Friday afternoon and turn them back on Monday early morning. This saves the company at least 104 days’ worth of expenses per year, which could be a significant amount. This is only one example, but with additional PowerShell automation scripts, a lot of additional tasks can be automated. This means a smaller, more knowledgeable team can maintain the same huge network infrastructures, which also results in savings for the company.
Resources to Get You Started
Here are some resources that will help you get started learning this amazing scripting language. One book that is great for beginners and provides thorough details about PowerShell is Learn Windows PowerShell in a Month of Lunches, by Don Jones and Jeffery Hicks. Don Jones’ YouTube channel is also worth checking out to see demonstrations of most concepts in the book. Another great resource to get started with PowerShell is a Microsoft Virtual Academy course titled: Getting Started with PowerShell 3.0 Jump Start. This video series is worth watching because it is led by Jeffrey Snover, who is one of the inventors of Windows PowerShell. I hope these three compelling reasons were convincing enough for you to begin your journey with PowerShell and start developing staggering automation scripts!