1 Reply Latest reply on Jan 22, 2019 11:19 PM by tdanner

    SWSQL or TSQL to Delete a Node from Solarwinds Tables when the Node is no longer in Active Directory

    wickedoz

      I am trying to find a way to delete a node from Solarwinds, using Powershell, TSQL or SWSQL. I would download a list of Nodes in Active Directory that are currently joined to the domain. This would allow Solarwinds to stop monitoring, and alerting, on Nodes that have been removed from the Domain. This is a common problem for us since we use Solarwinds to monitor our Public PCs at the Columbus Library. We are using NPM 12.2

        • Re: SWSQL or TSQL to Delete a Node from Solarwinds Tables when the Node is no longer in Active Directory
          tdanner

          Powershell would be a reasonable tool for this job. At a high level, you would want to export the node list from NPM like this:

           

          $swis = Connect-Swis # your connection details here

          $npmNodes = Get-SwisData $swis "SELECT Caption, DNS, IPAddress, Uri FROM Orion.Nodes" # maybe add a WHERE clause to exclude network devices from this process

          $adNodes = # get your list of domain members somewhere

          $nodesToDelete = $npmNodes |? { # filter out the $adNodes # }

          $nodesToDelete |% { $_.Uri } | Remove-SwisObject $swis

           

          This is off the cuff and untested and I wimped out on writing the code to actually compute the set difference. Hopefully this is enough to get you started.