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
p_065
Mar 30, 2022Copper Contributor