Open WSLAB3D opened 4 months ago
What do you mean by "find the membership query"?
As far as creating a query group, I've looked into it before and I passed on it at the time. There's a lot to it. This is what I would need to put it together (thinking out loud). Seems doable but no promises on when I can deliver. This is a side project of mine and not my day job.
I could create commandlets for Get-QuerySupportContext, Get-QuerySupportField and Get-QuerySupportOperator. Then you'd have to save these into variables and input them into a New-OMEQueryGroup commandlet like:
$Context = Get-QuerySupportContext | Where-Object { $_.Name -eq "Devices" }
$Field1 = Get-QuerySupportField -Context $Context | Where-Object { $_.Name -eq "Operating System Name" }
$Operator1 = Get-QuerySupportOperator | Where-Object { $_.Name -eq "=" }
$Field2 = Get-QuerySupportField -Context $Context | Where-Object { $_.Name -eq "OS Version" }
$Operator2 = Get-QuerySupportOperator | Where-Object { $_.Name -eq "contains" }
New-OMEQueryGroup -Context $Context -Fields @($Field1, $Field2) -FieldValues @("VMware ESXi", "8.0") -Operators @($Operator1, $Operator2) -LogicalOperator "AND"
The payload would look similar to the following:
{
"GroupModel" : {
"Name" : "My Dynamic Test Group",
"Description" : "This is a dynamic test group.",
"MembershipTypeId" : 24,
"ParentId" : 1022
},
"GroupModelExtension" : {
"ContextId" : 2,
"Conditions": [
{
"LogicalOperatorId": 1,
"LeftParen": false,
"FieldId": 56,
"OperatorId": 1,
"Value": "1000",
"RightParen": false
},
{
"LogicalOperatorId": 1,
"LeftParen": false,
"FieldId": 55,
"OperatorId": 7,
"Value": "poweredge",
"RightParen": false
}
]
}
}
https://developer.dell.com/apis/5898/versions/4.0.1/docs/Tasks/QueryGroups.md
Thanks Trevor, what I mean is to see the query that determines membership of the query group. Is there a way to retrieve the query relating to an existing group
I'll have a look into this and see what I can pull together.
Cheers,
Will
I see that the Group Query is available at /api/GroupService/Groups(groupid)/GroupQuery - it would be great if the output from this could be included in the response from Get-OMEGroup. I'll have a go at this when I have some time
I can get the list of groups, and determine which devices are in the groups, but I cannot find the membership query or create a dynamic group.
we use this to create query groups based on ESXi version so that we can create firmware baselines using the ESXi catalogs matching the installed ESXi version. It would be great to be able to automate this