Speeding up multiple SolarWinds Orion Products Installations

I stumbled across an article called Install Orion products in unattended or silent mode that made me so happy because I install new Orion servers about 4 times a month.  There are only so many time I want to click “Next,” “Next”, “Finish” in any given day.  So, since I do this so often, I wanted to script this out.  The big two takeaways from this article are that you run the installer silently and can skip the Configuration Wizard from running after installation.

I’ve used this procedure after I’ve run my other build scripts (Create VM [Hyper-V], Create VM [VMware], Prepare the Disks, and Prepare the Computer).

So here’s the thought process:

  1. Save the Installers in a folder and give them short names.
  2. Create a function that will install them.
  3. Keep track to see when one completes.
  4. Let me know how long it took. (because I’m nosy)

Step 1 – Download & Rename the Installers

To download the installers, go to your Customer Portal and download the latest versions of each of your products.  I then extract out the installer (the “.exe” file) and leave the rest of the documentation.  I save that file into a central location (on my Orion Servers, this is “D:\Download”).  Then I rename them.  This is just for convenience, but I prefer the Three-Letter Acronym, followed by the version.  So “SolarWinds-NPM-v12.1-Full.exe” becomes “NPM_12.1.0.exe.”  This just helps me keep things straight.

Step 2 – Getting crafty with functions

The process is pretty straight forward, but please use my knowledge and scripts if you plan on doing this.  I forgot a thing or seven when I started writing this and was forced to revert to snapshot more than once.

The function is broken up into a few parts:

  • The parameter block with argument details.
  • The begin block where I setup a stopwatch.
  • The process block where I kick off the installation.
  • The end block where I stop the stopwatch.

Parameter Block

[Parameter(Mandatory=$true,
           Position=0)]
[ValidateSet( "NPM",
              "SAM",
              "NCM",
              "IPAM",
              "VNQM",
              "WPM",
              "UDT",
              "SPM",
              "Toolset",
              "ETS",
              "NCM",
              "SRM" )]
[string]$Product

What this is saying is that there is a single parameter in position zero (first position) and it must match one of the list of names.  You’ll notice one Orion module missing – I already know.  More about that at a later date.

Begin Block

Begin
{
    $Sw = New-Object -TypeName System.Diagnostics.Stopwatch
    $Sw.Start()
}

This basically stands up a Stopwatch object.  Which is just a way to keep time.  It’s not strictly necessary, but I like to know how long the installation took.

Process Block

Process
{
    Write-Host "Beginning Installation of $Product"

    # Find Path for Installer
    # Get only the most latest version
    $Installer = Get-ChildItem -Filter "*$( $Product )_*.exe" | 
        Sort-Object -Property @{ Expression = { [Version]( $_.BaseName.Split("_")[-1] ) } } -Descending |
        Select-Object -First 1
        
    # Build the command line parapeters for silent installation
    $ArgumentList = @()
    $ArgumentList += "/S"
    $ArgumentList += "/NoConfigWizard"

    # Begin the installation
    Start-Process -FilePath $Installer.FullName -ArgumentList $ArgumentList
        
    # Create a loop to wait until the installation is complete
    # This could also be done with the "-Wait" parameter from Start-Process - I prefer this way
    Do
    {
        Start-Sleep -Seconds 1
    }
    Until ( -not ( Get-Process -Name $Installer.BaseName -ErrorAction SilentlyContinue ) )
    Write-Host "SolarWinds $Product Successfully Installed"
}

This is the meat of the function.  It basically searches for the latest version of the product in question.  This part requires that the name match the Three-Letter Acronym followed by an underscore and then the version.  So NPM_12.1.0.exe would be reported as version 12.1.0.000.  The .NET Framework already knows how to compare version numbers, so I’ll use that.

End Block

End
{
    $Sw.Stop()
    Write-Host "SolarWinds $Product installation took $( $Sw.Elapsed.TotalSeconds ) seconds."
    Remove-Variable -Name Sw -ErrorAction SilentlyContinue -Force -Confirm:$false
}

Close up shop and tell me how long the install took.

In total, the script looks like this:

function Install-OrionProduct
{
    [CmdletBinding()]
    [OutputType([int])]
    Param
    (
        [Parameter(Mandatory=$true,
                   Position=0)]
        [ValidateSet( "NPM",
                      "SAM",
                      "NCM",
                      "IPAM",
                      "VNQM",
                      "WPM",
                      "UDT",
                      "SPM",
                      "Toolset",
                      "ETS",
                      "NCM",
                      "SRM" )]
        [string]$Product
    )

    Begin
    {

        $Sw = New-Object -TypeName System.Diagnostics.Stopwatch
        $Sw.Start()
    }
    Process
    {
        Write-Host "Beginning Installation of $Product"

        # Find Path for Installer
        # Get only the most latest version
        $Installer = Get-ChildItem -Filter "*$( $Product )_*.exe" | 
            Sort-Object -Property @{ Expression = { [Version]( $_.BaseName.Split("_")[-1] ) } } -Descending |
            Select-Object -First 1
        
        # Build the command line parapeters for silent installation
        $ArgumentList = @()
        $ArgumentList += "/S"
        $ArgumentList += "/NoConfigWizard"

        # Begin the installation
        Start-Process -FilePath $Installer.FullName -ArgumentList $ArgumentList
        
        # Create a loop to wait until the installation is complete
        # This could also be done with the "-Wait" parameter from Start-Process - I prefer this way
        Do
        {
            Start-Sleep -Seconds 1
        }
        Until ( -not ( Get-Process -Name $Installer.BaseName -ErrorAction SilentlyContinue ) )
        Write-Host "SolarWinds $Product Successfully Installed"
    }
    End
    {
        $Sw.Stop()
        Write-Host "SolarWinds $Product installation took $( $Sw.Elapsed.TotalSeconds ) seconds."
        Remove-Variable -Name Sw -ErrorAction SilentlyContinue -Force -Confirm:$false
    }
}

Running the Script:

# Save the funciton to the same place as your installers.

# Change to the Installer Location
Set-Location -Path "D:\Downloads"

# "dot" include the function
. func_Install-OrionProduct.ps1

Install-OrionProduct -Product NPM

Results:

Beginning Installation of NPM

SolarWinds NPM Successfully Installed

SolarWinds NPM installation took 241.8324 seconds.

If you are very bored, you can watch the entire process below. (This is sped up to 10x so you don’t have to wait too long).

1 thought on “Speeding up multiple SolarWinds Orion Products Installations”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.