cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

IMPORT / UPLOAD ORION MAPS [POWERSHELL]

Hello.

I have created a script which can upload OrionMap files (and thier associated images if required) to the SolarWinds database without the need for Network Atlas or ImportMapBatch as these were slow GUI applications.

The script i have created takes seconds to upload the files, so it is much quicker and means this process can be automated.

The reason i needed this automated was because i was tasked with creating a script to map our servers (which are constantly changing) in a graphical way in SolarWinds. So i created a script which can produce correct OrionMap files on-the-fly for the layout of our servers (without using Network Atlas, this was all automated based on the information it retrieves from SWIS). I needed a way of automating the import / upload to the SolarWinds Orion database, as this is where the map files are stored when they are imported with Network Atlas or ImportMapBatch.

Specifically, they are stored in the MapStudioFiles table. The actual map data is stored in the FileData column, so if you convert the MapFile or Image into a byte array, they can be uploaded to the database directly using the CRUD powershell functions.

My other problem with ImportMapBatch was if you were uploading a file which already existed (so updating a map), all of the Web UI map widget links to that map would break (as it would create a new entry in the database for the new map, and the Web UI map widget would still point to the old deleted map). My script addresses this by checking if a map with that file name already exists, saving the FileId it used, completely removing the old map, then uploading the new map with the old FileId. Which gives seamless map updates without breaking the Web UI map widgets.

I want to give a massive thankyou to KMSigma for his work on the Export map script, this helped me get the conversion to a byte array working and gave me a better understanding of the MapStudioFiles table, the link to his script is here, its very useful for backing up existing maps.

Export Orion Maps [PowerShell]

Please modify and use this script however you want, it would be especially useful if you had a task like i did where you had to automate the creation and upload of the maps, or you were just looking for a faster way of uploading the maps.

GitHub - akaProxim/SolarWindsOrionMapUploader: A Powershell script to upload OrionMaps (and thier as...

Comments

Should $FileContents on line 48 be changed to $bytes? I don't see where that variable ever gets populated, so nothing is getting uploaded.


My bad, that was a variable left in from before when I was reading the file in differently, it's now been removed, thanks for pointing that out

Very slick!

Version history
Revision #:
1 of 1
Last update:
‎04-03-2019 05:09 AM
Updated by: