-
Notifications
You must be signed in to change notification settings - Fork 4
New AcmaQueryGroup
Ryan Newington edited this page Sep 4, 2025
·
10 revisions
Creates a new group of query objects that search for objects in the database. This cmdlet generates a DBQueryObject that can be used with the Get-AcmaObjects cmdlet
## Syntax
```powershell
New-AcmaQueryGroup -Operator <AcmaGroupOperator> -Queries <AcmaDBQueryObject[]>
The logical operator to use when combining the queries. Valid values include:
-
All- All queries must match -
Any- Any query can match -
None- None of the queries should match (logical NOT) -
One- Exactly one query should match (exclusive OR)
Required: Yes Position: Named Pipeline input: No
An array of query objects to combine. These can be created using:
-
New-AcmaQuery- Value comparison queries -
New-AcmaPresenceQuery- Presence/absence queries - Other
New-AcmaQueryGroupobjects for nested logic
Required: Yes Position: Named Pipeline input: No
Returns an AcmaDBQueryObject that can be used with Get-AcmaObjects
$query1 = New-AcmaQuery -Attribute "department" -Operator Equals -Value "Finance"
$query2 = New-AcmaQuery -Attribute "mail" -Operator EndsWith -Value "acma.com"
$query = New-AcmaQueryGroup -Operator All -Queries @($query1, $query2)
$objects = Get-AcmaObjects $query$query1 = New-AcmaQuery -Attribute "department" -Operator Equals -Value "IT"
$query2 = New-AcmaQuery -Attribute "department" -Operator Equals -Value "Finance"
$query = New-AcmaQueryGroup -Operator Any -Queries @($query1, $query2)
$objects = Get-AcmaObjects $query$query1 = New-AcmaQuery -Attribute "department" -Operator Equals -Value "Terminated"
$query2 = New-AcmaQuery -Attribute "accountDisabled" -Operator Equals -Value $true
$query = New-AcmaQueryGroup -Operator None -Queries @($query1, $query2)
$objects = Get-AcmaObjects $query## Parameters
### Operator
The type of operator to use on the contained query objects.
| Value | Description |
| --- | --- |
| All | All contained queries must be satisfied for a match to be found |
| Any | Any of the contained queries must be satisfied for a match to be found |
| None | None of the contained queries must be satisfied for a match to be found |
| One | Only one of the contained queries must be successful for a match to be found |
### QueryObjects
An array of query objects that were created with the [[New-AcmaQuery]], [[New-AcmaPresenceQuery]], or [[New-AcmaQueryGroup]] cmdlets
## Return type
The cmdlet returns an AcmaDBQueryObject
## Examples
```powershell
$query1 = New-AcmaQuery -AttributeName "department" -Operator Equals -Value "Finance";
$query2 = New-AcmaQuery -AttributeName "mail" -Operator EndsWith -Value "acma.com";
$query = New-AcmaQueryGroup -Operator All -QueryObjects @($query1, $query2);
$objects = Get-AcmaObjects $query