This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Invoke-SwisVerb : Verb Orion.AlertSuppression.SuppressAlerts cannot unpackage parameter 0 of type System.String

Import-Module SwisPowerShell

$OrionServer = 'localhost'
$cred = Get-Credential

$swis = Connect-Swis -Hostname $OrionServer -Credential $cred

$server = 'my-server'
$query = "SELECT Uri FROM Orion.Nodes WHERE SysName LIKE '" + "$server" + "%'"
$entityUris = Get-SwisData $swis $query
$entityUris = $entityUris |% {[string]$_}

Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts @($entityUris)

Trying to mute alerts on an object, using the code above and always receive the following error message:

Invoke-SwisVerb : Verb Orion.AlertSuppression.SuppressAlerts cannot unpackage parameter 0 of type System.String[]
At line:13 char:1
+ Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts @($entity ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1
    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

  • Try sending the $entityUris by itself and not wrapping it as an array so:

    .... SuppressAlerts $entityUris

  • Hi,

    It doesn't seem to matter how I pass the parameter, the following all fail:

    Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts "swis://myserver.mydomain/Orion/Orion.Nodes/NodeID=29"
    Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts $entityUris
    Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts @($entityUris)
    Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts (@($entityUris))

  • Ahh I should have caught that. The verb needs 3 paramaters in the array.

    1) entity uri

    2) start time Utc

    3) end time Utc or $null .. not providing this param may be the same as providing $null with the end result of an indefinite mute

    So this should work:

    $now = (Get-Date)::UtcNow

    $2hoursFromNow = $now.AddHours(2)

    .... SuppressAlerts @($entityUris, $now, $2hoursFromNow)

  • Hi,

    Thanks for looking into this, but I am still getting the same error. See logs:

    2022-10-06 08:33:41,091 [138] ERROR SolarWinds.InformationService.Core.InformationService - SwisPowerShell (null)	 Exception for Operation: <s:Envelope xmlns:s="" xmlns:a="" xmlns:u="">
        <a:Action s:mustUnderstand="1"></a:Action>
        <i18n xmlns="" xmlns:i="">
        <SwisSettings xmlns="" xmlns:i="">
        <SwisProtocolVersion xmlns="">2</SwisProtocolVersion>
        <IsBase64EncodingAccepted xmlns="">true</IsBase64EncodingAccepted>
        <a:To s:mustUnderstand="1">net.tcp://localhost:17777/SolarWinds/InformationService/v3/Orion/ssl</a:To>
        <o:Security s:mustUnderstand="1" xmlns:o="">
          <u:Timestamp u:Id="_0">
          <c:SecurityContextToken u:Id="uuid-7db53a10-8fcd-4c3c-80d6-e5f35466ca7d-258" xmlns:c="">
          <Signature xmlns="">
              <CanonicalizationMethod Algorithm="">
              <SignatureMethod Algorithm="">
              <Reference URI="#_0">
                  <Transform Algorithm="">
                <DigestMethod Algorithm="">
                <o:Reference URI="#uuid-7db53a10-8fcd-4c3c-80d6-e5f35466ca7d-258">
        <Invoke xmlns="">
          <parameters xmlns:b="" xmlns:i="">
              <string xmlns="">swis://myserver/Orion/Orion.Nodes/NodeID=29</string>
              <dateTime xmlns="">2022-10-06T08:33:41.0761391Z</dateTime>
              <dateTime xmlns="">2022-10-06T10:33:41.0761391Z</dateTime>
    2022-10-06 08:33:41,091 [138] ERROR SolarWinds.InformationService.Core.InformationService - SwisPowerShell (null)	 Exception caught in method SolarWinds.InformationService.Core.InformationService.Invoke
    SolarWinds.InformationService.Verb.VerbExecutorException: Verb Orion.AlertSuppression.SuppressAlerts cannot unpackage parameter 0 of type System.String[] ---> System.Runtime.Serialization.SerializationException: Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''. 
       at ReadArrayOfstringFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
       at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
       at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
       at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
       at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
       at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
       at SolarWinds.InformationService.Verb.VerbExecutorContext.<>c__DisplayClass19_0.<UnpackageParameters>b__0(Int32 index)
       --- End of inner exception stack trace ---
       at SolarWinds.InformationService.Verb.VerbExecutorContext.<>c__DisplayClass19_0.<UnpackageParameters>b__0(Int32 index)
       at SolarWinds.InformationService.Verb.VerbExecutorContext.CreateParameters(Func`2 getParameterAt, Int32 parametersCount, Stream stream)
       at SolarWinds.InformationService.Verb.VerbExecutorContext.UnpackageParameters(XmlElement[] parameters, Stream stream)
       at SolarWinds.InformationService.Core.InformationService.<>c__DisplayClass18_0.<Invoke>b__0(VerbExecutorContext context)
       at SolarWinds.InformationService.Core.InformationService.Invoke[T](String entity, String verb, Action`1 setupParameters, Func`2 extractReturnValue)

  • This is an example that I used just yesterday, and it works on Platform version 2022.3.

    $NodesToMute = Get-SwisData -SwisConnection $SwisConnection -Query "SELECT Caption, Uri FROM Orion.Nodes WHERE IPAddress LIKE '10.149.%.%'"
    # We are in the central time zone, right now, so those are reflected in the hand-typed entries below
    $suppressFrom  = Get-Date "2022-09-17 01:00 AM" # 11 PM, Friday - Los Angeles Time
    $suppressUntil = Get-Date "2022-09-18 04:00 PM" # 5 PM, Sunday  - Los Angeles Time
    # Flip them to UTC
    $suppressFrom = $suppressFrom.ToUniversalTime()
    $suppressUntil = $suppressUntil.ToUniversalTime()
    Invoke-SwisVerb -SwisConnection $SwisConnection -EntityName 'Orion.AlertSuppression' -Verb 'SuppressAlerts' -Arguments $NodesToMute.Uri , $suppressFrom, $suppressUntil

  • Hi - do you have any more ideas on this? 

  • What does your powershell code look like (start to finish) now, could you provide it? This works for me without issue...

  • Hi, 

    I am going to wait until we update our Platform/SDK Versions, and then test this again. Thanks for your help. 

  • Get-Module -ListAvailable -Name SwisPowerShell

        Directory: C:\Users\MyUsernameHere\Documents\PowerShell\Modules
    ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
    ---------- -------    ---------- ----                                --------- ----------------
    Binary             SwisPowerShell                      Desk      {Connect-Swis, Get-SwisData, Get-SwisOb…

    My tests have been running on SwisPowerShell version

  • Thanks, I think our Platform/SDK version is pretty outdated - so I'm not sure if Suppressing/Muting alerts is supported in this build. For now I can unmanage a node fine. Once we have updated I will test again and report back. 

  • Please also provide what version of the SolarWinds Platform you are connecting to.  

    It's available at the bottom of any page after login.

  • Hey, yes this is pretty outdated as well -  2020.2.6.

Reply Children