Forum Discussion
p_065
Mar 28, 2022Copper Contributor
Get-CsOnlineUser -Filter
Get-CsOnlineUser -Filter {SipAddress -eq $null} | Select-Object DisplayName for the above command can there be alternative now that Sip address has been removed Can we get Sip Address other than a...
LainRobertson
Mar 30, 2022Silver Contributor
This will get you very close to what you are after.
Even if you do need a client-side filter to get rid of a few strays (I found one in my sample set), the volume returned from Microsoft will still be greatly reduced which may make a noticeable difference depending on how large your environment is.
Example that pulls enabled users without client-side filtering:
Get-CsOnlineUser -LdapFilter "(&(objectCategory=person)(!userAccountControl:1.2.840.113556.1.4.803:=2)(!proxyAddresses=sip:*))" | Select-Object ObjectId, @{n="AccountEnabled"; e={ -not $_.UserAccountControl.Contains("AccountDisabled") }}, Enabled, UserPrincipalName, SipAddress
Example that pulls enabled users with client-side filtering:
Get-CsOnlineUser -LdapFilter "(&(objectCategory=person)(!userAccountControl:1.2.840.113556.1.4.803:=2)(!proxyAddresses=sip:*))" | Where-Object { -not $_.SipAddress } | Select-Object ObjectId, @{n="AccountEnabled"; e={ -not $_.UserAccountControl.Contains("AccountDisabled") }}, Enabled, UserPrincipalName, SipAddress
Cheers,
Lain
- Newbie_JonesMar 30, 2022Brass ContributorSimilar example using standard filter.
Get-CSOnlineUser -Filter {enabled -eq 'true' -and (msExchRecipientTypeDetails -eq '1' -or msExchRecipientTypeDetails -eq '2147483648') -and ProxyAddresses -like 'sip:*'}
You can go to town on the filter, and also use searchbase to limit the scope. - p_065Mar 30, 2022Copper Contributor