Using filters in web queries
Overview
This article contains step-by-step instructions on how to configure filters in the Active Directory and Microsoft 365 web queries for the following scenarios in the Web Portal:
Filter AD users by custom AD attribute
Web Portal uses the standard Microsoft Ambiguous Name Resolution search.
To search AD users in the Web Portalby some custom AD attribute that is not included in the Ambiguous Name Resolution set you should perform the following steps:
In the Cayosoft Administrator Console navigate to the AD Users web query.
-
In the Query criteria, specify filtering condition by custom AD attribute. For example, URL:
URL -like $searchValueWithAsterisk. Save changes.
Filter suspended AD users and groups
To filter AD users and groups who are suspended by the Cayosoft Suspend™ utility you should perform the following configuration:
In the Cayosoft Administrator Console, navigate to the AD Users web query (or AD groups web query).
-
In the Query criteria, add additional condition to get suspended objects only:
Copy-and (accountNameHistory -like "*<objectsuspended/>*")} Save changes.
Filter AD groups whose name starts with a specified string
In the Cayosoft Administrator Console, navigate to the AD Users web query.
In the Query criteria, add the additional condition to find only the needed groups. For example, to find groups whose names starts with
DL_Salesforce_*, the additional condition should be-and (Name -like "DL_Salesforce_*")}
Save changes.
Filter AD users who are members of a certain scope of groups
Option 1
To filter AD users who are members of a certain scope of groups, you need to configure a post- filter on the Ad Users web query. This will return users according to the query and then filter them out post-query. This method has two considerations:
There is a performance impact since you're getting the users first and then filtering them after the fact. For a few hundred users this is negligible, but for large sets, it can have a large impact.
-
You always have to use Show All when searching for users. If you return only the first 20 users, the post-filter will work only on those 20 and not on the entire set returned by the query.
NOTE: When building a post-filter that uses a Virtual Attributes property, ensure that the property is wrapped in $(...). For example:
$($_.yourVirtualAttrName).Post-query filter configuration:
In the Cayosoft Administrator Console, navigate to the AD Users web query.
Open the More Options section.
Add the MemberOf attribute to Other required properties.
In the Filter, specify filtering condition by Member of AD attribute:
{$_.MemberOf -like "CN=Active Directory Users*"}-
Save changes.
Before searching users in this web query in the Web Portal, set
Show = All:
Option 2
The second method is better in terms of performance and searching for the user, but each group must be specified explicitly. The idea is to include the memberOf attribute in the web query Query Criteria directly:
Filter AD computers by Operating System
In the Cayosoft Administrator Console, navigate to the AD Computers web query.
In the Query criteria, add the additional condition to filter by Operating System:
-and (OperatingSystem -eq "Windows Server 2016 Standard")}Save changes.
Filter Microsoft 365 users by assigned license
In the Cayosoft Administrator Console, navigate to the Users (Microsoft 365) web query.
Open the Other Query Settings section.
Add AssignedLicenses to the Properties to display.
-
Set the Post-query filter to
Copy{$_.AssignedLicenses.SkuID -contains "1f2f344a-700d-42c9- 9427-5cea1d5d7ba6"}where
Copy1f2f344a-700d-42c9-9427-5cea1d5d7ba6is a SkuID of the license by which you want to filter.
To get the license SkuID, you need to run the following script in PowerShell using credentials of Microsoft 365 connection account:
$credential = Get-Credential
Connect-MsolService -Credential $Credential Get-MsolAccountSku | ConvertTo-Json
The Users web query should be configured like this:
Comments
0 comments
Please sign in to leave a comment.