This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Node ManageMent via API

I have not submitted to many "How To's" But this one below saved me a massive amount of time.  I hope it does the same for someone else.

We have a large environment with a decent amount of hyper V servers.  Keeping nodes on specific engines due to network scans was always a trouble.  I have a few scripts that were recently executed in Prod that worked wonderfully.  I was able to re-allocate 10,000 nodes in a matter of minutes (about 15 total).  In this SolarWinds instance IP address determines polling engine.  For whatever reason (must have a lot of Hyper V) our Hyper V licensing will get extremely close to maxing out, even while the general polling capacity has plenty of room.

The script below does the following

-Identifies all devices in the specified ranges

-ensures they are not hyper V

-ensures they are not already on poller 5.  I did not want the API executing changes not necessary.

-Places them on poller 5

$ErrorActionPreference = 'Stop'

#Add the snapin
Add-PSSnapin SwisSnapin

#create a connection to solarwinds

$hostname = 'X'
$username = 'X'
$password = 'X'

#swis = Connect-Swis -Hostanme $hostname -Trusted
$swis = Connect-Swis -Hostname $hostname -Username $username -Password $password

$targetEngineId =@{ EngineId = 5; }

$uris = Get-SwisData $swis "SELECT uri FROM Orion.Nodes WHERE (ip_address LIKE '100.0.%' OR ip_address LIKE '100.15.%' OR ip_address LIKE '100.17.%' OR ip_address LIKE '100.20.%' OR ip_address LIKE '100.21.%') AND (MachineType <> 'Hyper-V Server') AND (EngineId = '1' OR EngineId = '3' OR EngineId = '2 OR EngineId = '4' OR EngineId = '4')"

# Line below must be un-comment for this to work

#$uris | Set-SwisObject $swis -properties $targetEngineId

#Checked  the found URI's prior to submitting.  Comment out line below when satisfied with results

$uris

All this fun would not of been possible without the community, thanks!