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.

Help formatting invoking a swisverb?

I am trying to use powershell to invoke-swisverb and automate updating some alertaction's EmailTo property. Based on the examples I have found online this should be how the command should be formatted.

Invoke-SwisVerb -EntityName Orion.Actions -Verb UpdateActionsProperties -SwisConnection $swis -Arguments @(@{PropertyName = 'EmailTo';PropertyValue = 'newemail@myorg.com'},{1110,1111})


When I run the above it returns an object of XmlElement, which has a #text property that has value 'true'; however, the alert is not updated. 

I have also tried the following, but with the same result (XmlElement returned, but it doesn't update the alert properties).

Invoke-SwisVerb -EntityName Orion.Actions -Verb UpdateActionsProperties -SwisConnection $swis -Arguments @(@{EmailTo='newemail@myorg.com'},{1110,1111})


Can anyone help me spot what I'm doing wrong?

Parents
  • I've never done it using the Verb myself.  I've done it using Set-SwisObject

    $Swis = Connect-Swis -Hostname myOrionServer.domain.local -UserName "myUsername" -Password "myComplexPassword"
    $OldEmail = "oldemail@myorg.com"
    $NewEmail = "newemail@myorg.com"
    
    # Get all alert action properties in my environment where there is an old email
    $Uris = Get-SwisData -SwisConnection $Swis -Query "SELECT Uri FROM Orion.ActionsProperties WHERE PropertyName = 'emailTo' AND PropertyValue = '$OldEmail'"
    ForEach ( $Uri in $Uris ) {
        Set-SwisObject -SwisConnection $Swis -Uri $Uri -Properties @{ PropertyValue = $NewEmail }
    }

    The verb should work, but I've personally never tried it.

  • This worked, thank you. I guess I didn't expect each property to have its own URI.

Reply Children
No Data