We are being tasked to start removing servers from SolarWinds. We are being asked to do about 200 a day. Is there a script I can run to do this quickly?
Should be an easy task from SolarWinds UI. Settings -> Manage Nodes -> select the ones that you want to delete and delete them in one shot.
If that seems difficult then another easy way to do it export the node name, IP Address through Custom property editor. Create a new custom attribute and update that with a particular name, through import in Custom property editor. Then follow the same approach of Settings -> Manage nodes -> Group by using that custom attribute to select all the nodes that you want to delete in one shot and delete them at once.
This would hardly take about 10 mins of manual effort.
Here's an example of removing nodes with SwisPowershell (https://www.powershellgallery.com/packages/SwisPowerShell)
Couple things you'll need to change. You'll need to figure out your scope, so the query will need to be changed for your environment, e.g. how you'll select just those 200 nodes you intend on removing. There's an explicit "SELECT TOP 200" in the query. Below is an example what I use a text value that's in a text nodes custom property called "MyCustomProperty" where the data "removeme" is expected.
Also the "Remove-SwisObject" is commented out, I'd recommend you verify this works without that first before actually removing anything.
Something else to consider, I'm not sure if this removes agents..
Import-Module -Name "SwisPowershell"$swis = Connect-Swis -Hostname "localhost" -Trusted$query = @"SELECT TOP 200 n.Caption ,n.IP_Address ,n.CustomProperties.MyCustomProperty ,n.UriFROM Orion.Nodes AS nWHERE n.CustomProperties.MyCustomProperty LIKE '%removeme%'$selection = Get-SwisData -SwisConnection $swis -Query $queryForEach ($node in $selection) { Write-Output("Removing node " + $node.Caption + " (Uri: " + $node.Uri + ")") # Remove-SwisObject -SwisConnection $swis -Uri $node.Uri}
OMG this will work! I didnt even think about this! Thank you!