wp_add_inline_script(). Please see Debugging in WordPress for more information. (This message was added in version 4.5.0.) in /opt/bitnami/apps/wordpress/htdocs/wp-includes/functions.php on line 4773
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:
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:
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.
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.
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.
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!