Forum Discussion

p_065's avatar
p_065
Copper Contributor
Mar 28, 2022

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 above

by get-cs online user list

4 Replies

  • LainRobertson's avatar
    LainRobertson
    Silver Contributor

    p_065 

     

    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_Jones's avatar
      Newbie_Jones
      Brass Contributor
      Similar 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.

Resources