Network Management
Use PowerShell and SQL scripts to discover configuration data on your existing Orion database server when migrating
This article describes how to use a PowerShell script, along with several SQL scripts, to discover configuration data on your existing Orion database server so you can use that information as a reference when migrating to a new Orion database server. These scripts were developed for use in environments compromised by the SUNBURST vulnerability and are intended for use on Orion Platform 2019.4 and 2020.2. For the latest details about the vulnerability, including affected Orion Platform versions, see the SolarWinds Security Advisory.
First published date
Last published date
Overview
In response to the recent security vulnerability, SolarWinds created a PowerShell script that runs in conjunction with SQL scripts to discover configuration data on your existing Orion database server. You can use this data, available in CSV and JSON format, as you recreate your original Orion database installation on a new server.
Note: For the latest details about the vulnerability, including affected Orion Platform versions, see the SolarWinds Security Advisory.
For security reasons, output files are not intended to be directly imported into the new Orion database. Instead, use the data as a guide to recreate the Orion database on the new server so it matches the original Orion installation.
Before downloading the zip file from the link provided below, note the following details:
- In addition to the main PowerShell script, db-exporter.ps1, several SQL scripts gather data from the main Orion Platform and individual Orion Platform modules. For example, core_custom-properties-metadata.sql detects custom properties used by NPM, SAM, and many other modules, while ipam_subnet-list.sql collects a list of subnets used only by IPAM.
- Download the zip file and extract the contents to a location where scripts can access the original Orion database. If you quarantined the Orion database server, you may need to download and extract contents directly on the server.
- Each SQL script creates corresponding CSV and JSON files in the output directory, along with an index.html file that summarizes the content in generated files. If a script cannot detect the related Orion Platform module, no output files are created. This is normal, expected behavior.
- If your environment includes Log Analyzer (LA), run the PowerShell script on the Orion Log Analyzer database also so SQL scripts such as la_agents.sql and la_node-settings.sql can collect data.
Requirements include:
- A Windows SQL Server account that is a member of the db-owner role.
- PowerShell 5 or later. PowerShell is included in most versions of Windows Server or you can install it. See Installing PowerShell on Windows (© 2021 Microsoft Corp., available at docs.microsoft.com, obtained on January 8, 2021).
The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.
Product section
Resolution
To run the PowerShell script to gather data from your existing Orion database:
-
Download the orion-db-exporter.zip file.
-
Extract file contents to a location where the PowerShell script can access the original Orion database. If the Orion database server is quarantined, you may need to download and extract contents directly on the server.
-
In the same directory as the PowerShell script, run the following command to verify hash values:
Get-FileHash db-exporter.ps1
Algorithm Hash SHA1 54FE29297EC57F2AF2CCC5EFB98B7DD263CD1B7B SHA256 89702D4974E3D58CC306B6E2FC736E60BE6128252BC3B8D8AFBC8815214DE0C8 MD5 040AD1B439D8D313CC042990727A141C -
Use the following command to run the script: ./db-exporter.ps1
-
When prompted, provide the following values and press Enter:
• The SQL Server address (default is localhost)
• Database name (default is SolarWindsOrion)
• Database username (default is SolarWindsOrionDatabaseUser)
• Database password
After creating an output directory in <yyMMdd-HHmm>-<servername>-<database> format, the PowerShell script runs SQL scripts, generates CSV and JSON files, and creates an index.html file that summarizes findings and provides access to files.Script progress appears in the PowerShell Console, as shown in this example:
If errors occur, review instructions provided. Note that an "empty dataset" message appears for a script if the related module is not detected in your environment. This is normal, expected behavior
-
If your environment includes Log Analyzer (LA), repeat steps 1 - 5 for the Orion Log Analyzer database so SQL scripts such as la_agents.sql can collect data.
To display script results, click index.html in the output folder. When the DB Export – Results page appears, you can expand individual rows to see a summary of data that was captured. Click CSV and JSON links to open individual output files.
Add credentials to a launch configuration
If you plan to run the PowerShell script repeatedly, you can add a launch configuration with arguments to provide credentials automatically each time the script runs.
Here is a Visual Studio Code example:
{
"name": "PowerShell: db-exporter",
"type": "PowerShell",
"request": "launch",
"script": "${workspaceFolder}/db-exporter.ps1",
"args": ["-server", "10.199.78...", "-database", "SolarWindsOrion", "-user", "SolarWindsOrionDatabaseUser", "-password", "***",
"cwd": "${workspaceFolder}"
},
You can also run the script directly from the command line using script parameters, as shown in the following example:
./db-exporter.ps1 -server 10.199.78... -database "SolarWindsOrion" -user "SolarWindsOrionDatabaseUser" -password "***"
-- Scripts are not supported under any SolarWinds support program or service.
-- Scripts are provided AS IS without warranty of any kind. SolarWinds further
-- disclaims all warranties including, without limitation, any implied warranties
-- of merchantability or of fitness for a particular purpose. The risk arising
-- out of the use or performance of the scripts and documentation stays with you.
-- In no event shall SolarWinds or anyone else involved in the creation,
-- production, or delivery of the scripts be liable for any damages whatsoever
-- (including, without limitation, damages for loss of business profits, business
-- interruption, loss of business information, or other pecuniary loss) arising
-- out of the use of or inability to use the scripts or documentation.