Hello, we are migrating to the SolarWinds platform. I want to create group and populate them using a csv file.
I have created a custom property named _group. The filtering doesn't work. Groups are filled with every node.
The excepted behavious is to the group populated with the matching name inside _group.
Set-Location -Path E:\WIP\
# Create groups inside NPM
$groups = import-csv .\Orion.Container.Group | Select-Object -Property DisplayName, Description | Sort-Object -Property Displayname
# Build Connection to SWIS - SolarWinds Platform
$SwisHost = "localhost"
$SwisCreds = Get-Credential -Message "Enter the username/password for '$SwisHost'" -UserName
$SwisConnection = Connect-Swis -Hostname $SwisHost -Credential $SwisCreds
foreach ($group in $groups) {
$members = @(
@{ Name = $group.DisplayName; Definition = "filter:/Orion.Nodes[CustomProperties._group=$($group.DisplayName)]"}
)
$groupId = (Invoke-SwisVerb $swisConnection "Orion.Container" "CreateContainer" @(
# group name
$group.DisplayName,
# 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
$group.description,
# polling enabled/disabled = true/false (in lowercase)
"true",
# group members
([xml]@(
"",
[string]( $members | ForEach-Object {
"$($_.Name)filter:/Orion.Nodes[CustomProperties._Group=$($group.DisplayName)]"
}
),
""
)).DocumentElement
))
Write-Warning $($group.DisplayName)
}