Hello Guys,
I can't find how to add a node to group/container with powershell,
i have the uri of the node and for the group but i don't know how to merge them,
Please help with simple powershell code
Thanks
I found it
the groupID is int32 paremeter, set the id and now it's fine-
if anybody needs it, here's the code:
Invoke-SwisVerb $swis "Orion.Container" "AddDefinition" @(
# group ID ## int32 number
17,
# group member to add
([xml]"
<MemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>
<Name>NodeName</Name>
<Definition>$NodeUri</Definition>
</MemberDefinitionInfo>"
).DocumentElement
) | Out-Null
Hi,
You can find powershell samples for Groups manipulation @C:\Program Files (x86)\SolarWinds\Orion SDK\Samples\PowerShell\Groups.ps1 (Your SDK installed directory)
i saw the folder and can't get it out from the script-
the "GroupID" in the example is for a new group
i want to add members to an existing group
if you know how to do it from the example there please cut and paste the right code,
any help is welcome
thanks
Provided the code to add one or more members to a group. Here the you need to replace the bolded with groupid and uri / condition.
# ADDING A NEW GROUP MEMBER
# group ID
$groupId,
<Name>Up Devices</Name>
<Definition>swis://xxx-xxxx-xxxx-01./Orion/Orion.Nodes/NodeID=1</Definition>
=========================================================================
#
# ADDING MULTIPLE NEW GROUP MEMBERS
$members = @(
@{ Name = "Down Devices"; Definition = "filter:/Orion.Nodes[Status=2]" },
@{ Name = "Unreachable Devices"; Definition = "filter:/Orion.Nodes[Status=12]" }
)
Invoke-SwisVerb $swis "Orion.Container" "AddDefinitions" @(
([xml]@(
"<ArrayOfMemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>",
[string]($members |% {
"<MemberDefinitionInfo><Name>$($_.Name)</Name><Definition>$($_.Definition)</Definition></MemberDefinitionInfo>"
}
),
"</ArrayOfMemberDefinitionInfo>"
)).DocumentElement
Do you know how to find the ID of a group/Container?