For years now, the SolarWinds Orion API has been accessible to run via PowerShell on Windows machines. Initially through the Snap-In (SwisSnapIn
) and later through the Module (SwisPowerShell
).Although not technically deprecated, the Windows PowerShell 5.1 engine is being phased out for replacement with PowerShell 7 (formerly PowerShell Core).
Our approach to working with the functionality needs to change with time.
The (Extremely) Quick Intro to PowerShell 7
The most succinct way to describe how PowerShell 7 differs from previous Windows PowerShell versions is in the name – it lacks “Windows.” PowerShell 7 is a cross-platform management framework that runs on Windows, macOS, Linux, and even ARM processors. This allows for the same scripts to run anywhere and everywhere. It’s a bold move and one move in the right direction, but some things have been left behind.
Where is PowerShell ISE?
To put it bluntly, the Integrated Scripting Environment (ISE) is no longer maintained. Like Windows PowerShell 5.1, the ISE can only run on Windows machines. And while all modern versions of Windows can support it, its lack of cross-platform functionality was counterproductive given the multi-operating system support for PowerShell 7. For proper multi-platform support, something new needed to be used.
Enter Visual Studio Code
The de facto replacement for the PowerShell ISE is Visual Studio Code (VS Code), and it’s for so much more than just PowerShell. VS Code supports dozens and dozens of programming languages, has thousands of extensions to make working more manageable and more efficient, and has a modern aesthetic to boot. Don’t be fooled by the name, Visual Studio Code is not the same as Visual Studio.
VS Code is supported on most major platforms (x86, x64, ARM, and ARM-64) and most operating systems (Windows, Linux, macOS).This makes it an excellent tool if you are just getting started with scripting, as the experience will be near identical for all your collaborators, regardless of the OS or platform.
Why aren’t PowerShell 7 and VS Code bundled together?
There are many reasons, but the core of it is that PowerShell is a command line interpreter and needs no GUI, whereas VS Code is a visual editor and needs a GUI. If you have a Linux machine that doesn’t have Gnome, KDE, or another X Windows system installed, you can still run PowerShell. Just install it, and it’s available to use from the terminal.
The Key to Using a Tool is Flexibility
Microsoft knew that when they started moving PowerShell (and any associated editor) to an open-source solution, consumers would want to use the tools in the best way possible for their own situations.That versatility was part of the original mandate for designing VS Code.If you want to write a script in Perl, you need to be able to do it.If you want to work in Python, you need that capability.If C# was your forte, so be it; the tool must support that.If all you touch is HTML and CSS, the solution must work for you.Nothing differentiates Visual Studio Code from traditional Visual Studio products more than its ease of extensibility and configuration for the casual scripter/programmer/web dev.
Part of embracing this flexibility is using the best tools for you.This widely depends on if you have a preferred Integrated Development Environment/Integrated Scripting Environment (IDE/ISE) or prefer to work in other ways.VS Code is not the only option available to you.Many successful scripters work in nothing but a plain text editor like nano, notepad, emacs, vim, or Notepad++.If you prefer Sublime, Eclipse, the full Visual Studio product, or something else, please feel free to use that.Each choice comes with its benefits and determents.
For the sake of continuity, this book uses Visual Studio Code (referred to as “VS Code”) for all screenshots.All code samples provided in this book will work provided the following:
- You have installed PowerShell version 7 or higher.
- You have installed the SolarWinds Orion PowerShell module version 3 or higher.
If you elect to work with another editor (or multiple editors), please work in whatever way makes you most comfortable.
Co-hosting with Orion Platform Products
No rule says you cannot install PowerShell 7 and VS Code on the server running your Orion Platform products, but my go-to has always been to run them adjacent to those machines. It doesn’t even need to be a server; it just needs to be a computer where you have some GUI. I have always preferred to have a UTIL server on the same subnet as my Orion servers. It makes it so that I can easily do work on the UTIL server (including rebooting or restarting local services after updates), and I won’t disturb my monitoring solution from doing its job.
The following steps show how to set up PowerShell 7 and VS Code on a separate machine from that running the SolarWinds Orion platform products. The steps are outlined in detail on Microsoft’s site [PowerShell, VS Code] to install both PowerShell 7 and VS Code. Please refer to those documents if you have problems.
Again, if you prefer not to use Visual Studio Code, you can install the SolarWinds Orion PowerShell module after completing your PowerShell 7 installation. Follow the instructions for Installing the SolarWinds Orion PowerShell Module from a regular PowerShell session.
Continue to the Step-by-Step Installation Instructions [PowerShell 7+] section.