ServiceNow Operational State Change

Hi all,

When a ServiceNow instance in Orion automatically changes to a Restricted state do you have to manually change this back to Enabled or should it automatically revert to Enabled?

Thanks

Top Replies

Parents
  • You have to manually change it back - but you can write a powershell script to do it X minutes after it changes to restricted, based on setting up an alert for the change.

  • Hi I have been having same issue can you please advise how would you do that with Powershell script I have not been able to find a way to interact with that integration through Powershell

  • , is referring to changing it via a PowerShell script against SW using SWIS. The table you'd have to modify is Orion.ESI.IncidentService. The below script should be able to get you started.

    # Import SolarWinds Module
    import-Module SwisPowerShell
    
    $integrations = Get-SwisData $swis -query "SELECT InstanceID, Type, Name, Url, CredentialID, OperationalState, Status, DetailsUrl, CustomData, DisplayName, Description, InstanceType, Uri, InstanceSiteId
    FROM Orion.ESI.IncidentService
    WHERE Status like '%Restricted%'"
    
    #Iterates through returned list of Restricted Integrations and set Status to Enabled
    foreach ($integration in $integrations){
      $update =@{
        Status = 'Enabled'
      }
      Write-Output "Setting Integration: $integration.Name from $integration.Status to Enabled"
      Set-SwisObject $swis -Uri $integration.uri -Properties $update
      }
    }

  • My powershell is triggered from an alert which detects the Operational Status and then executes:

    Invoke-SwisVerb $swis Orion.Reporting ExecuteSQL @("UPDATE ESI_Instance SET OperationalState = 2 WHERE Name = 'NameOfTheIntegration'")

    's solution looks far more elegant.

Reply Children
No Data