Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

After running powershell script to add group and members, the members do not show up

$
0
0

I am using a powershell script to add a group and a dynamic query to add members to that group.  The group is added, but no members show up.  If it edit the group, I can see the dynamic query was created.  I edit the dynamic query and I can see that the query is accurate.  If I hit save, then the members show up now.  It seems like the script adds the config in correctly, but doesn't "apply" it.  I am using the standard script I found online that everyone else says works.  I am on 2018.4 and was wondering if there is a bug in the latest version that is causing this.  Here is my script to add just one group/members.

 

import-module SwisPowerShell

# Connect to SWIS

$hostname = <Removed>

$swis = Connect-Swis -host $hostname

$GroupName = <Removed>

#

# CREATING A NEW GROUP

#

$members = @(

    @{ Name = $GroupName; Definition = "filter:/Orion.Nodes[CustomProperties.NMS_Role=$GroupName]" }

)

 

 

$groupId = (Invoke-SwisVerb $swis "Orion.Container" "CreateContainer" @(

    # group name

    "Building - $GroupName",

 

 

    # owner, must be 'Core'

    "Core",

 

 

    # refresh frequency

    60,

 

 

    # Status rollup mode:

    # 0 = Mixed status shows warning

    # 1 = Show worst status

    # 2 = Show best status

    0,

 

 

    # group description

    "Devices that are located in building $GroupName",

 

 

    # polling enabled/disabled = true/false (in lowercase)

    "true",

 

 

    # group members 

    ([xml]@( 

       "<ArrayOfMemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>", 

       [string]($members |% { 

         "<MemberDefinitionInfo><Name>$($_.Name)</Name><Definition>$($_.Definition)</Definition></MemberDefinitionInfo>" 

         } 

       ), 

       "</ArrayOfMemberDefinitionInfo>" 

    )).DocumentElement 

  )).InnerText 


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>