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

Parents
  • 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="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <s:Header>
        <a:Action s:mustUnderstand="1">http://schemas.solarwinds.com/2007/08/informationservice/InformationService/Invoke</a:Action>
        <a:MessageID>urn:uuid:8e8ad3cd-df48-458f-8c09-2d8b3405f52e</a:MessageID>
        <a:ReplyTo>
          <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
        </a:ReplyTo>
        <i18n xmlns="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <Culture>en-US</Culture>
        </i18n>
        <SwisSettings xmlns="http://schemas.solarwinds.com/2007/08/informationservice" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <AppendErrors>true</AppendErrors>
          <ApplicationTag>SwisPowerShell</ApplicationTag>
          <DataProviderTimeout>PT30S</DataProviderTimeout>
        </SwisSettings>
        <SwisProtocolVersion xmlns="http://schemas.solarwinds.com/2007/08/informationservice">2</SwisProtocolVersion>
        <IsBase64EncodingAccepted xmlns="http://schemas.solarwinds.com/2007/08/informationservice">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="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <u:Timestamp u:Id="_0">
            <u:Created>2022-10-06T08:33:41.076Z</u:Created>
            <u:Expires>2022-10-06T08:38:41.076Z</u:Expires>
          </u:Timestamp>
          <c:SecurityContextToken u:Id="uuid-7db53a10-8fcd-4c3c-80d6-e5f35466ca7d-258" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
            <c:Identifier>urn:uuid:e6de553b-1910-4cf5-9414-800e660bb437</c:Identifier>
          </c:SecurityContextToken>
          <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
            <SignedInfo>
              <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
              </CanonicalizationMethod>
              <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1">
              </SignatureMethod>
              <Reference URI="#_0">
                <Transforms>
                  <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                  </Transform>
                </Transforms>
                <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
                </DigestMethod>
                <DigestValue>wf0b+o9bIi3gQWLHzFZ6fqzPTb0=</DigestValue>
              </Reference>
            </SignedInfo>
            <SignatureValue>MtGukuNwDDI9x+433HOIt+7w8ZM=</SignatureValue>
            <KeyInfo>
              <o:SecurityTokenReference>
                <o:Reference URI="#uuid-7db53a10-8fcd-4c3c-80d6-e5f35466ca7d-258">
                </o:Reference>
              </o:SecurityTokenReference>
            </KeyInfo>
          </Signature>
        </o:Security>
      </s:Header>
      <s:Body>
        <Invoke xmlns="http://schemas.solarwinds.com/2007/08/informationservice">
          <entity>Orion.AlertSuppression</entity>
          <verb>SuppressAlerts</verb>
          <parameters xmlns:b="http://schemas.datacontract.org/2004/07/System.Xml" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <b:XmlElement>
              <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">swis://myserver/Orion/Orion.Nodes/NodeID=29</string>
            </b:XmlElement>
            <b:XmlElement>
              <dateTime xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2022-10-06T08:33:41.0761391Z</dateTime>
            </b:XmlElement>
            <b:XmlElement>
              <dateTime xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2022-10-06T10:33:41.0761391Z</dateTime>
            </b:XmlElement>
          </parameters>
        </Invoke>
      </s:Body>
    </s:Envelope>
    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

Reply
  • 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

Children
No Data