In-Depth

Automate Using Windows PowerShell

New capabilities make automating IT processes easier and worthwhile.

IT pros these days tend to wear many hats and handle seemingly random tasks on a daily basis. At any given time, you may find yourself dealing with an angry user about an Outlook problem, while bringing up a new virtual server and creating a few Active Directory user accounts for a new line-of-business application. IT operations people are the ultimate multitaskers.

Some are more successful than others in handling the multifaceted requirements of IT shops today. What makes someone a "go-to" IT person? It's those who excel at getting work done who typically earn that reputation. They're smart, work efficiently and always have enough time to help not only users, but also assist others in the IT organization. Yet they're always able to leave at 5 p.m., while others are struggling to get work done. How do they do it? For many it's their ability to bring automation to their tasks. And a growing number are bringing new levels of automation thanks to capabilities in the latest release of the Microsoft Windows PowerShell scripting environment.

The Windows scripting tool has gained some significant adoption across the IT infrastructure landscape since Microsoft first released it in 2006. And now Microsoft is stepping up its emphasis of Windows PowerShell. At this month's Ignite conference in Chicago (the event replacing TechEd), Microsoft will present 18 technical sessions devoted to Windows PowerShell. That's a major increase over last year's TechEd North America in Houston when there were 10 sessions, and just four the year before in New Orleans. In 2012 Microsoft didn't hold any sessions covering Windows PowerShell. IT pros who use the Windows PowerShell console and asso­ciated tools can replace the traditional command prompt to automate routines and other checks associated with PC and infrastructure management.

The Windows PowerShell Vision
To understand the momentum behind Windows PowerShell, it's important to understand its origins. Windows PowerShell is a Windows console replacement/scripting language originally concocted in 2002 by Jeffrey Snover, a distinguished engineer at Microsoft. Snover is now known as the father of Windows PowerShell and is the lead architect of Windows Server and System Center at Microsoft. Ironically, though as it came to pass fortuitously, Snover came to Microsoft in 1999 from Digital Equipment Corp. with a background in Unix, in which automation was easy due to its inherent architecture of using simple text files for configuration. Snover realized based on the way it was originally designed, Windows wasn't capable of the kind of automation Unix admins were leveraging. Administrators, myself included, at the time tried their best to automate Windows processes in VBScript. If you've ever written more than a few hundred lines in VBScript you'll understand why I say, "tried their best."

Snover believed Windows tasks could be as easy to automate as Unix using the ultimately popular Microsoft .NET Framework. He envisioned a platform that embraced standard­ization across OSes, allowed IT pros (not just developers) to leverage the power of the .NET Framework through objects and much more.

Initially, his vision fell on deaf ears. Not only was he not able to convince Microsoft of the virtues of automating Windows tasks, his efforts landed him a demotion. Undeterred, he finally prevailed with the release of Windows PowerShell 1.0 in 2006 with Windows XP SP2, Windows Server 2003 and Windows Vista.

From Rags to Riches
So much has changed since the first version of Windows PowerShell. The Windows PowerShell version 5 preview boasts a fully featured script editor and a complete configuration management extension called Desired State Configuration (DSC), which you can read more about it here. DSC is a critical new addition to Windows PowerShell because it allows IT pros to configure a server once and ensure it stays that way. It offers powerful remoting capabilities through the WS-MAN protocol that give a full-featured psexec-like experience and has a package manager similar to the Linux world's RPM Package Manager (RPM).

The Windows PowerShell team is consistently adding more features by routinely releasing new versions with subsequent versions of Windows, let alone the near-monthly DSC "waves." Even though Windows PowerShell is rapidly becoming more robust and applicable for orchestration of cloud and multiplatform environments, many IT professionals are resisting the change that comes with automating tasks.

Dozens, if not hundreds, of products now rely on Windows PowerShell as a management and automation platform. Microsoft introduced Windows Server 2008 Core in 2008 -- the minimal installation instantiation of the server OS -- and made Server Core the default install option for Windows Server 2012, which isn't even usable without Windows PowerShell. Yet many IT pros are struggling to change their work routine, put down the mouse and play in the command line as Unix geeks have for decades now.

Windows PowerShell is gaining adoption every year due to Microsoft and, thus by proxy, all of the other software products that have hooks into its software. Even though it took Snover a long time to convince Microsoft of this, as a company it now sees Windows PowerShell as the future of automating Windows and the Windows command line and encourages -- if not forces -- all future Microsoft products to have full Windows PowerShell support.

As you're about to see in further detail, Windows PowerShell today is on the rise, but hasn't quite achieved mainstream adoption. With time, however, you'll begin to see more and more companies require the kind of automation skills that Windows PowerShell can provide. The industry as a whole seemed OK with subpar automation for a while but it wasn't until the DevOps movement -- the new way of managing IT by bringing operational considerations and people into the software development, testing and deployment process -- came along that the industry raised its expectations for automated operations. That's why knowing how to build and utilize Windows PowerShell scripts and learning its forthcoming new capabilities such as DSC are becoming critical for IT pros.

The Growth of Windows PowerShell
Look how far Windows PowerShell has come in less than a decade. Among searches for the most popular languages, the toddler Windows PowerShell has taken on old geezers in the scripting world, including VBScript, Perl, Bash and Batch, all of which have been around for decades. You'll notice a steady decline for all languages (see Figure 1) to eventually meet the Windows PowerShell interest this year (see Figure 2).

[Click on image for larger view.] Figure 1. The trajectory of Windows PowerShell versus other languages. Source: Google Trends
[Click on image for larger view.] Figure 2. Google Trends illustrates Windows PowerShell interest continues to rise.

As a side effect of overall Windows PowerShell interest, you're beginning to see more IT hiring managers preferring, if not insisting on, job candidates with Windows PowerShell experience. Any job search site today will show hundreds to thousands of jobs calling for Windows PowerShell experience. What's more amazing is the job titles run the gamut from the typical Systems Administrator and Windows Systems Engineer to Enterprise Network Support, SQL Server DBA Engineer and even Security Analyst, according to a March 2015 job search on Monster.

Vendor Adoption
Adding to the appeal of Windows PowerShell is its extensibility. Because it supports standards-based management, especially with its introduction of Open Management Infrastructure, hundreds of IT vendors large and small are seeing Windows PowerShell as the way to manage their products from the command line. Companies including Cisco Systems Inc., Dell Inc., EMC Corp. Hewlett-Packard Co., NetApp and many others now support Windows PowerShell and are extending PowerShell support to provide IT pros with not only Windows automation, but automation and full management across the entire infrastructure.

Imagine a day when you can write a set of WindowsPowerShell scripts that can provision and configure an entire datacenter. The reality is fast approaching. Windows PowerShell now has full support of nearly every object available in the Windows OS and all Microsoft technologies. This is a given, but who actually has all Microsoft technologies in their datacenter? Who really uses Routing and Remote Access Services (RRAS) over a tried-and-true Cisco ASA firewall?

With Windows PowerShell having growing support for standards, it may soon be possible to script out every layer of your datacenter from setting up VLANs on the switches, carving out LUNs on your SAN, configuring your Cisco UCS chassis, installing and configuring your VMware ESXi infrastructure on that chassis, to provisioning virtual servers and installing and configuring Windows (or Linux). Never has any other technology come close to this kind of automation across so many different platforms.

Going to the Cloud
Another common concern is the cloud. IT pros who've honed their skills in an on-premises datacenter racking dozens or hundreds of physical servers, ensuring they remained cool while maintaining tight security, have that all-too-common feeling: outsourcing. If the traditional on-premises datacenter is going off to the elusive cloud, then what work will be left to the IT pro? Plenty, if the IT pro evolves.

Popular Windows PowerShell proponent (and former Redmond columnist) Don Jones has a saying for how IT pros should look at it. "You need to be the one who makes the tools, not the one who clicks the tools." In other words, the most successful IT pros are those who build the Windows PowerShell scripts for the others who just want to "do their job." To survive as an IT pro, you must learn to adapt and that means embracing automation and stop clicking through the software wizards.

One of the best aspects of Windows PowerShell is its all-encompassing presence across the IT infrastructure. Windows PowerShell has its hooks in so many different technologies that learning and embracing it gives IT pros the freedom to take those skills and apply them in numerous areas including the provisioning, orchestration and management of infrastructure and applications in public and hybrid cloud environments.

While IT pros may fear cloud services such as Microsoft Azure, Amazon Web Services and others will automate away their usefulness, IT pros are very much needed to manage these services and users simply want their applications to run without interruption. The difference is before the rise of the public cloud, those services were served by massive servers in on-site datacenters. Now the services have simply shifted to another datacenter somewhere else. Hence, with this shift, comes new ways to provision, connect to and manage these services.

It means "the server is down" no longer applies due to the distributed nature of the services. A more common scenario is something like five on-premises application servers with three back-end Azure SQL Databases with other file system resources stored in Amazon S3, but with full capability to utilize more cloud infrastructure services if a load gets too high on a moment's notice. There's no way this can be managed like traditional on-premises IT infrastructure. This entire orchestration needs to be automated and Windows PowerShell is emerging as the scripting environment for this new environment.

The good news is, nearly every cloud provider has some kind of Windows PowerShell support. If they don't, it's flexible enough to easily create your own -- and indeed many are doing so. Windows PowerShell expertise is portable and prevalent, so you can take your skills with you to your next job.

Featured

comments powered by Disqus

Subscribe on YouTube