Automating Unmanaging Nodes

We were looking into if there was a way to unmanage nodes in Solarwinds automatically.  I know there is the Solarwinds Unmanage Tool that creates the *.bat files to set as scheduled tasks.  Did this ever get updated to be configurable in Solarwinds proper?  I can't seem to find it if so.  We were curious if there was anyway to tie to to a ServiceNow ticket where someone would request something to be unmanaged and it would kick off a script to unmanage a server in Solarwinds for a certain time period.  

Parents Reply Children
  • How do you run that script?  Do you have someone manually execute it or does it run through a ticketing system of somesort?

  • If you Google 'execute PowerShell script from ServiceNow' there are several articles that go into detail on how it is done.

  • Here is a script I use sometimes, it grabs a list of nodes from a file. I didn't take the time to convert the time to local time so take note in the script. 

    You will need to have the Solarwinds SDK installed to use it which is available at GitHub. 

    Add-PSSnapin SwisSnapin
    $swis = Connect-Swis -host YOURORIONSERVERGOESHERE -Trusted
    Write-Host " "
    Write-Host "Important, the script MUST run in UTC time. Local EST and UTC time is displayed below for reference"
    Write-Host "Ensure the variables below for $StartInUTC and  $EndInUTC are in UTC"
    Write-Host "There is a SWQL query you can run in SWQL studio at the bottom of the script to verify the nodes that you unmanage have the correct times"
    Write-Host " "
    $dateT = Get-Date -Format "dddd MM/dd/yyyy HH:mm K"
    Echo "Current EST Date and Time is $dateT UTC Offset"
    $UTCTime = Get-Date -UFormat "%A %B/%d/%Y %T %Z"
    $Time = Get-Date
    $UTCTIME = $Time.ToUniversalTime()
    Echo "Current UTC Date and Time is $UTCTIME"
    $StartInUTC = "1/18/2023 13:45:00 PM"
    $EndInUTC = "1/18/2023 13:50:00 PM"
    Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE IPAddress IN @IPAddress" @{IPAddress=(Get-Content c:\powershellscripts\UnmanageNodes\nodelistWest.txt)} | Set-SwisObject $swis -Properties Orion.AlertSuppression SuppressAlerts @(SuppressFrom=$StartInUTC; SuppressUntil$EndInUTC )
    #Here is the SWQL Query to verify your work
    #SELECT TOP 1000 NodeID, IPAddress, Caption, UnManaged, TOLOCAL (UnManageFrom) AS LocalUnManageFrom, TOLOCAL (UnManageUntil) AS LocalReManageTime
    #FROM Orion.Nodes
    #--Adjust the Where to your needs below
    #--Where UnManaged = TRUE
    #ORDER BY UnManageUntil