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
Thanks
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
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,
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
Invoke-SwisVerb $swis "Orion.Container" "AddDefinition" @(
# group ID
$groupId,
# group member to add
([xml]"
<MemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>
<Name>Up Devices</Name>
<Definition>swis://xxx-xxxx-xxxx-01./Orion/Orion.Nodes/NodeID=1</Definition>
</MemberDefinitionInfo>"
).DocumentElement
) | Out-Null
=========================================================================
#
# 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" @(
# group ID
$groupId,
# group member to add
([xml]@(
"<ArrayOfMemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>",
[string]($members |% {
"<MemberDefinitionInfo><Name>$($_.Name)</Name><Definition>$($_.Definition)</Definition></MemberDefinitionInfo>"
}
),
"</ArrayOfMemberDefinitionInfo>"
)).DocumentElement
) | Out-Null
get-swisdata $swis "SELECT ContainerID, Name, Owner, Frequency, StatusCalculator, RollupType, IsDeleted, PollingEnabled, LastChanged FROM Orion.Container where Name = 'Sample Powershell Group'"
Modify the select statement to select only ContainerID in case you need only container ID.
You can have a look at the documentation @"C:\Program Files (x86)\SolarWinds\Orion SDK\Documentation". It has more information on SWIS and SWQL.
Have a look at C:\Program Files (x86)\SolarWinds\Orion SDK\Documentation\Orion SDK.pdf. It has all the information you need with examples (It is not specific to containers but has information on how to get specific data, invoke verb and much more)
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 195,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.