Has anyone used SWQL or SQL to update a Bearer Token value for an API Poller?

We have a token that we renew on a regular basis.  When we have monthly patching and reboots of systems, the token is expiring during this process.  I created a .bat file that can generate a new token and I can parse it out to get the new token.  I would like to store it in the existing Bearer Token, or create a new one and update the token being used by the 5 other API Pollers that are using the same Bearer Token.  Any ideas on how to update this information with a script?

Parents Reply
  • #Documentation: https://github.com/solarwinds/OrionSDK/wiki/Credential-Management
    
    # Connect to the SolarWinds server
    $hostname = ""
    $username = ""
    $password = ""
    $swis = Connect-Swis -Soap12 https://$hostname/swvm/services/InformationService -Username $username -Password $password -IgnoreSslErrors
    
    
    
    $bearer_token_credset = ""
    $bearer_token_desc = ""
    $bearer_token = ""
    
    $properties = [System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]]::new()
    $properties.Add("Name", $bearer_token_credset);
    $properties.Add("Description", $bearer_token_desc);
    $properties.Add("Token", $bearer_token);
    
    
    # Define the parameters for the UpdateCredential function
    $CredentialID = 201
    # Call the UpdateCredential function
    Invoke-SwisVerb $swis Orion.Credential UpdateCredentials @($CredentialID, $properties)
    


    This is the error I'm getting:

Children