Jul 31 2021 08:02 PM - edited Aug 01 2021 05:55 PM
Since Friday July 20th 2021,
Every time I run a Get-CsOnlineUser with a Filter on a boolean attribute, I am getting an error.
Example 1: Getting users with Voice Enabled:
Get-CsOnlineUser -Filter {EnterpriseVoiceEnabled -eq $true}
Example 2: Getting Enabled Users:
Get-CsOnlineUser -Filter {Enabled -eq $true}
The Response I get is always:
Get-CsOnlineUser: Cannot bind parameter 'Filter' to the target. Exception setting "Filter": "Unable to cast object of type 'System.Boolean' to type 'System.String'."
Any ideas what could be happening here?
Aug 01 2021 09:29 AM
Just tried and I seem to have the same problem.
I have the Microsoft Teams Version 2.3.1 module installed.
Aug 01 2021 05:54 PM
I started getting this error a couple days ago as well. It was working Thursday or Friday, but is now producing this error.
Aug 01 2021 06:15 PM
Aug 02 2021 06:35 AM
Aug 02 2021 06:34 PM
Aug 02 2021 08:15 PM - edited Aug 02 2021 08:17 PM
The ticket is still open. Their support resource provided a wrongful suggestion using "$true" as true and "$null" as false. This is not a valid solution as any non-empty string would resolve true.
For now , the two viable workarounds I identified are:
1. Using any non-empty string (ex. 'banana') as true and an empty string '' as false.
Not ideal and a bit of a hack using an empty/non-empty string as my flags.
2. Using Where-Object {$_.EnterpriseVoiceEnabled -eq $true} instead.
Also not ideal as it is way less efficient as it first fetches the non-filtered results to then discard a bunch via the Where-Object.
Still waiting on a better fix.
Aug 02 2021 09:10 PM
@ckarawani-dev thank you for the update. making those changes on my scripts worked.
Aug 10 2021 05:08 PM
I had the issue for just over a week, I have run my original scripts without the workaround below and the issue appears to be resolved I do NOT receive the error now using filters as below
get-csonlineuser -filter {(Enterprisevoiceenabled -eq $true) -and (enabled -eq $true)}
Aug 10 2021 06:52 PM
@jeffkelly wow! You're right! It is indeed fixed. I'm really not sure what we're supposed to do in the future when these types of issues occur. Opening a service request via the Microsoft 365 admin center (admin.microsoft.com) didn't really help much as they were not really aware of the problem and could not provide any explanation or support around the Microsoft Teams cmdlet.