As an IT professional or manager, when you think of the word "script," what comes to mind? Are images of VBScript and batch files still haunting you to this day? Are you just thinking about a nice, little piece of code that automates some mundane task? If so, let's get you introduced to a Windows PowerShell script.
In this article, we're going to uncover many of the different ways you can use PowerShell for things other than just a "scripting upgrade" from VBScript and batch files. If you're using PowerShell as just a way to read files, install Windows features or to transfer files in your daily routine, it's time to get exposed to what PowerShell can do.
First, and most importantly, did you know that PowerShell isn't just for Windows? It's 2016 and Microsoft isn't your father's Microsoft anymore. Today, the company has embraced open source and plays nice with other vendors. This is the reason why Windows PowerShell is now just PowerShell. It's available on Linux, MacOS and is fully open-sourced! This means that PowerShell scripts built for Windows can now be executed on other platforms as well. Granted, not everything will work but, with a little tweaking, it's possible.
PowerShell extends not only to operating systems but can reach out to numerous other systems as well. For one, PowerShell supports Open Management Infrastructure (OMI). This means that PowerShell scripts can control network switches, routers, network appliance and other hardware-based devices if they support the industry-standard OMI. If a network switch vendor supports OMI, imagine being able to run Get-NetworkSwitchEthernetPort as just another command in a large PowerShell script to provision a new employee's access. This means a script can not only create an Active Directory user, provision an Exchange mailbox, create a home folder, or even deploy a VDI virtual machine but it can also extend out onto the network as well.
PowerShell also has some built-in commands to interact with the web with cmdlets like Invoke-WebRequest and Invoke-RestMethod. PowerShell scripts can perform web scraping to collect information from web pages. Invoke-WebRequest makes it possible to "browse" to any website, log in, gather data and even make changes all via the web. PowerShell makes it possible to perform any level of web automation necessary. Also, with Invoke-RestMethod, it's possible to interact with a REST API easily. Lots of services have REST APIs these days and, if they do, it's possible to use PowerShell to reach out and perform any number of things allowing you to create your own IFTTT script.
Are you a developer or know a little about .NET or C# coding? If so, if, for some reason, the PowerShell language doesn't have a way to get something done, it's always possible to get into .NET right from PowerShell. Since PowerShell is built on top of the .NET Framework, it's easy to instantiate and work with any number of .NET objects and methods. In fact, you can even run C# code directly from PowerShell. With direct access to the .NET framework, the scripting possibilities are limitless.
Since PowerShell facilitates automation and automation saves companies time, money and establishes standardized approaches to tasks, full-time PowerShell developer positions are popping up. Did you ever hear of a full-time VBscript or batch file position before? Probably not. As soon as companies begin to realize the full potential of someone that knows PowerShell well and what they're capable of it's only a matter of time before they are just writing PowerShell. Available full-time PowerShell automation positions should be a significant indicator of just how much PowerShell is capable of.
This was just a few aspects of PowerShell that aren't widely known. This "scripting" language is capable of a lot more than just simple scripts. If used properly, PowerShell can evolve from an administrator's ad hoc scripting tool to a full-blown automation orchestration engine saving your company time and money.
Adam Bertram is a 25+ year IT veteran and an experienced online business professional. He’s a successful blogger, consultant, 6x Microsoft MVP, trainer, published author and freelance writer for dozens of publications. For how-to tech tutorials, catch up with Adam at adamtheautomator.com, connect on LinkedIn or follow him on X at @adbertram.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites