SolarWinds PowerShell Module 3.0.309 - Now Supporting PowerShell 7

If you’ve used the SolarWinds® PowerShell Module (SwisPowerShell) for any amount of time, you know one of the long-standing requirements was it ran under Windows® PowerShell (2.x, 3.x, 5.x). I’m pleased to tell you as of the 3.0.309 release, that’s no longer a constraint and it now can run under PowerShell (formerly called "PowerShell Core").

How is Windows PowerShell different from "just" PowerShell?

The most notable difference is implied directly in an omission in the name—you’re no longer required to use Windows to use the SolarWinds PowerShell Module. This means you can now interface with your Orion® Platform infrastructure via PowerShell on Windows, macOS, or Linux—the choice is entirely yours.

What about scripts I wrote using a pre-3.0.309 version of SwisPowerShell?

If those scripts depend only on the functions in the SwisPowerShell Module, they should still operate 100%. Most (if not all) of the work done on the module was “under the hood” and you won’t need to change anything. Not every function that existed in Windows PowerShell exists in PowerShell 7 (an example is Out-GridView), so you should still test before moving all scripts to a new scripting engines. If you want the deep-down developer-level details, you can check out the changes to the Orion SDK that made this possible in Target .NET Framework 4.8 and a little .NET Standard support and Enable PowerShell Core. If you have a problem with a script, then please visit the Orion SDK forum and ask a question.

You've sold me, how do I get started?

Before you install the SolarWinds PowerShell Module on your platform, you’ll first need to install PowerShell 7. Thankfully, Microsoft includes detailed documentation on the step-by-step process. For Windows, you install an MSI file as you would normally, for macOS, you use Homebrew to install PowerShell, and for Linux you add a repository to your machine and install using your package manager tool. The one Linux-based exception to this list is Raspbian (the default operating system for the Raspberry Pi), where you’ll need to download the bits and manually install.

Step-by-step example: Raspberry Pi

To show how the new PowerShell module works, I’m going to use a Raspberry Pi 4 running Raspberry Lite OS (2021-JAN-11).

Install PowerShell

Note: The actual installation of PowerShell is the only part of this step-by-step guide that will vary based on your operating system. Once you can confirm PowerShell 7.x is running on your system, you can follow along starting with installing the SwisPowerShell module.

Following the instructions on the Microsoft page, I was able to download and install PowerShell without a problem. Then from the PowerShell prompt I enumerated the PowerShell Version Table.

sudo apt update
sudo apt install '^libssl1.0.[0-9]$' libunwind8 -y
wget https://github.com/PowerShell/PowerShell/releases/download/v7.1.3/powershell-7.1.3-linux-arm32.tar.gz
mkdir ~/powershell
tar -xvf ./powershell-7.1.3-linux-arm32.tar.gz -C ~/powershell
~/powershell/pwsh

$PSVersionTable

Install PowerShell on Raspberry Pi

This device is now running PowerShell v7.1.3.

Install the SwisPowerShell module

Now that PowerShell is running on your machine, search for the PowerShell module to validate we’re seeing an available copy with at least version 3.0.309. The rest of these instructions are run from within PowerShell (indicated by the “PS <path>” prompt).

Find-Module -Name SwisPowerShell

Search for the SwisPowerShell module

Then we’ll install the module, allowing the PSGallery to be used as a repository.

Install-Module -Name SwisPowerShell

Install the SwisPowerShell module

Validate the module has been installed and is available

To validate the module was successfully installed, we can search for a command that’s only part of the SwisPowerShell Module.

Get-Command -Name Connect-Swis

Validate Commands Exist

Build credentials for your Orion server

First we’ll capture a simple set of credentials and store them. Then we’ll build the connection to your Orion server.

$SwisCreds = Get-Credential

Build Credential Set

Connect to and query the Orion Server

Finally, we’ll build a connection and make a simple query to the Orion system to get some data back.

$SwisConnection = Connect-Swis -Hostname "<your Orion server>" -Credential $SwisCreds

Get-SwisData -SwisConnection $SwisConnection -Query "SELECT Caption, IPAddress FROM Orion.Nodes"

Query the Orion API

Summary

This truly has been a labor of love to get this updated so people (regardless of operating system) can interface with their Orion Platform data as easily as possible. Now that the Windows-only restriction has been lifted, what’s the first thing you’ll do with the SolarWinds PowerShell module?

Thwack - Symbolize TM, R, and C