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
  • I keep getting an error when trying to use the invoke-swisverb

    Invoke-SwisVerb : Access to Orion.AlertSuppression.SuppressAlerts verb denied.

    Has anyone else seen this?

  • This works on mine, 2023.1 and 3.1.0.343  SwisPowerShell. I wrote it while we were on 2020.2.4 so it was working on that version as well. 

    Take a look and compare. 

    cls
    Import-Module SwisPowerShell
    $swis = Connect-Swis -host MyHost@bobmarley.org -UserName BobMarley -Password LetsGet2getherItWillBeAllRight
    #$swis = Connect-Swis -host MyHost@bobmarley.org -trusted
    $entityUris = Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE SysName LIKE'MYSERVERNAME'"
    $entityUris = @( $entityUris |% {[string]$_} )
    $now =[DateTime]::Now
    $later =$now.AddMinutes(5)
    Write-host "Muting Node from time in UTC $now until $later"
    Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts @($entityUris, $now, $later ) | Out-Null
    

  • I still get the invoke-swis access to orion verb error.

    I tried it once like this.

    Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts @($entityUris, $now, $later ) | Out-Null

    I also tried adding the parameter names before the variables.

    Invoke-SwisVerb -SwisConnection $swis -EntityName Orion.AlertSuppression -Verb SuppressAlerts -Arguments @($entityUris, $now, $later ) | Out-Null

    Invoke-SwisVerb : Access to Orion.AlertSuppression.SuppressAlerts verb denied.
    At line:1 char:1
    + Invoke-SwisVerb $swis Orion.AlertSuppression SuppressAlerts @($entity ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1
    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

  • Did you try changing these values so they match your environment and run this script? This one worked in my environment.

  • Can you verify if the account you use to create swisconnection have enought right to mute/unmute object ?

    nodes = Get-SwisData $swis -Query "SELECT Uri FROM Orion.Nodes WHERE SysName LIKE 'MYSERVERNAME'"

    foreach ($Uri in $nodes) {
    Invoke-SwisVerb $swis -EntityName Orion.AlertSuppression -Verb SuppressAlerts -Arguments @( [string[]] $Uri, (Get-Date), (Get-Date).AddHours((99)))
    }
Reply
  • Can you verify if the account you use to create swisconnection have enought right to mute/unmute object ?

    nodes = Get-SwisData $swis -Query "SELECT Uri FROM Orion.Nodes WHERE SysName LIKE 'MYSERVERNAME'"

    foreach ($Uri in $nodes) {
    Invoke-SwisVerb $swis -EntityName Orion.AlertSuppression -Verb SuppressAlerts -Arguments @( [string[]] $Uri, (Get-Date), (Get-Date).AddHours((99)))
    }
Children
No Data