1 Reply Latest reply on Aug 5, 2015 5:07 PM by tdanner

    Orion SDK Unmanage Script works then Remanages before its set to


      I have a powershell script that uses a list of hostnames in a CSV to unmanage in mass via the Orion SDK. I have the results of the script exported to a log file. The Unmanage reports as successful however the node magically remanages itself before the UnManageUntil time. See screenshots below


      Script ran at 4:45pm using UnManageFrom time of Now (4:45pm) to UnManageUntil time of Now + 6 hours (10:45pm).



      However at 6:45pm the node is managed again. And triggers a reboot alert when rebooted during our maintenance window. This occurred for every node I unmanaged with my script so its not an isolated incident.



      Below is my powershell script. Is there something wrong with my script? What would make my nodes remanage exactly 2 hours after I unmanaged them and before they are set to?

      Im running NPM 11.0.1 and SAM 6.1.1


      Set-ExecutionPolicy RemoteSigned

      Add-PSSnapin SwisSnapin


      $HostnameList = @()

      Import-Csv c:\Hostnames.csv | ForEach-Object {$HostnameList += $_.Hostname}


      $cred = get-credential Admin

      $swis = Connect-Swis -host "orionserver" $cred




      ForEach ($Hostname in $HostnameList)


      $NodeID = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName LIKE '$Hostname' OR DNS LIKE '$Hostname'"

      $NodeIDStr = "N:" + $NodeID

      Invoke-SwisVerb $swis Orion.Nodes Unmanage @($NodeIDStr,$now,$later,"false") -ErrorAction SilentlyContinue | Out-Null

          IF ($NodeID) {

              $Hostname + " " + $NodeID + " has been UnManaged from " + $now + " until " + $later | Tee-Object C:\UnManageLog.txt -Append


          ELSE {

              $Hostname + " does not exist in SolarWinds or the Hostname is incorrect. Try FQDN." | Tee-Object C:\UnManageLog.txt -Append



        • Re: Orion SDK Unmanage Script works then Remanages before its set to

          SWIS works in UTC. So when you pass in 10:45PM, it interprets that as UTC. The time shown in the audit message is also UTC, though it would be better if it were clearly labeled as such.


          I can infer from your post that you are in US Eastern Daylight Time (UTC-4), because at 6:45PM local time, your node went managed again. You can make the script behave as you want by changing this line:



          to this:



          1 of 1 people found this helpful