Comments on: Using Filters with the Get-ExoMailbox Cmdlet https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/ Practical Office 365 News, Tips, and Tutorials Fri, 22 Jul 2022 16:29:03 +0000 hourly 1 https://wordpress.org/?v=6.3.2 By: Jahangir Shah https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-240836 Fri, 22 Jul 2022 16:29:03 +0000 https://practical365.com/?p=52223#comment-240836 In reply to Jahangir.

Got this fixed….

“ManagedBy -eq ‘$xyz'”

]]>
By: Jahangir https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-240832 Fri, 22 Jul 2022 14:33:19 +0000 https://practical365.com/?p=52223#comment-240832 I want to insert a vairiable in the below command, Can anyone help?
Get-Recipient -PropertySet ConsoleLargeSet -ResultSize ‘1000’ -SortBy DisplayName -RecipientType ‘DynamicDistributionGroup’,’MailNonUniversalGroup’,’MailUniversalDistributionGroup’,’MailUniversalSecurityGroup’ -Filter ‘((ManagedBy -eq ”CN=UserName,OU=Users,DC=sub,DC=Domain,DC=com”))’
”CN=UserName,OU=Users,DC=sub,DC=Domain,DC=com” – This needs to be replaced with a vairiable. For eg. $xyz.
I will pass CN of the user in $xyz.
Any Help appreciated.

]]>
By: Tony Redmond https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-240266 Fri, 08 Jul 2022 09:13:48 +0000 https://practical365.com/?p=52223#comment-240266 In reply to Dave.

Yep, it’s just one of those PowerShell things… It’s similar to the way that Graph comparisons insist on “true” rather than “True.”

]]>
By: Dave https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-240259 Fri, 08 Jul 2022 05:11:46 +0000 https://practical365.com/?p=52223#comment-240259 If anyone gets here like I did trying to extract data, the example Get-ExoMailbox -Filter {DisplayName -Like “*Tony*”}
throws a filter error like Tony mentioned, but Get-ExoMailbox -Filter {DisplayName -like “*Tony*”} returns results for me.
Just a small ‘l’ on the -like comparison operator

]]>
By: Tony Redmond https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-238538 Thu, 19 May 2022 08:57:01 +0000 https://practical365.com/?p=52223#comment-238538 In reply to Steve Hare.

Steve, I wrote this up to show how to get the count of unread messages from mailboxes:

Using the Graph API to Generate Mailbox Folder Statistics

A reader asked if it’s possible to use PowerShell to return the unread count for the Inbox folder in user mailboxes. The standard Exchange Online PowerShell cmdlets tell you a lot about mailbox folder statistics, but they can’t look inside a folder. But the Microsoft Graph APIs can, so a combination of PowerShell and the Graph deliver a solution to the problem.

https://office365itpros.com/2022/05/19/mailbox-folder-statistics/

]]>
By: Tony Redmond https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-238504 Mon, 16 May 2022 18:38:01 +0000 https://practical365.com/?p=52223#comment-238504 In reply to Steve Hare.

The Exchange Online cmdlets have never delivered this kind of information (which is why EWS exists). If you want to access folder-level detail about item unread counts, you need to use a Graph query, like:

https://graph.microsoft.com/v1.0/users/{UserId}/mailFolders/Inbox/messages?$filter=isRead ne true&$count=true

Where UserId is the Azure AD identifier for the user’s account.

]]>
By: Steve Hare https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-238501 Mon, 16 May 2022 17:57:53 +0000 https://practical365.com/?p=52223#comment-238501 Tony,
I’m trying to get daily unread email statistics for my office, I can successfully run this on our Exchange online. and it seems to work, but really I just want what’s in the Inbox for unread mail. Is there a SearchQuery attribute for folders? something like (Folder:Inbox)?

Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq “UserMailbox”} | Search-Mailbox -SearchQuery ‘(isread:false) AND (kind:email)’ -estimateresultonly -donotincludearchive

Sidenote, I’m shocked at how difficult this is. I tried using AdminDroid, manageEngine and a whole bunch of other pre-built apps and none of them can get this statistic for me (I asked and everything). so I’m resigned to do it myself.

]]>
By: Tony Redmond https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-237439 Tue, 04 Jan 2022 03:19:39 +0000 https://practical365.com/?p=52223#comment-237439 In reply to Joshua Bines.

Some of the filtering capabilities are still not as good with the new cmdlets. They are built for speed in terms of fetching very large numbers of objects and this meant that some compromises had to be made in terms of how things work. We have both cmdlets available, so the rule of thumb is probably:

When you need to fetch large numbers of mailboxes, use the REST cmdlet (Get-ExoMailbox) or a Graph call.
When you need precision, use a server-side filter… and use Get-Mailbox if it is more functional than Get-ExoMailbox.

]]>
By: Joshua Bines https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-237431 Mon, 03 Jan 2022 18:56:24 +0000 https://practical365.com/?p=52223#comment-237431 Just for your feedback.

I thought about converting to Get-ExoMailbox for the below CMDlet but I still get a better reponse using the old filter switch. I am surprised about the limited v2 filter options.

Get-Mailbox -Filter “AuditEnabled -ne ‘$true’ -and (PersistedCapabilities -ne ‘BPOS_S_EquivioAnalytics’) -and (PersistedCapabilities -ne ‘M365Auditing’)”

]]>
By: Tony Redmond https://practical365.com/using-filters-with-the-get-exomailbox-cmdlet/#comment-236016 Mon, 19 Jul 2021 14:17:29 +0000 https://practical365.com/?p=52223#comment-236016 In reply to Eric.

What kind of filter do you want to apply? You might be forced to use a client-side filter as the -Filter parameter (server-side filter) has some https://docs.microsoft.com/en-us/powershell/exchange/recipient-filters?view=exchange-ps#custom-filters-using-the-filter-parameter

]]>