locked
unable to filter on get-csuseronline powershell RRS feed

  • Question

  • Hi All,

    I am hoping someone can help me here, I am trying to query the WhenChanged attribute in get-csonlineuser through PowerShell. However when I do the following:

    get-csonlineuser -filter {WhenChanged -ge "01/09/2016 00:00:00"} (please note I have tried everything with the date format)

    It just brings me back everyone and does not filter out those who changed timestamp is older than given date. However if I use the Where-Object passing the query of:

    Where-object {$_.WhenChanged -ge "01/09/2016 00:00:00"} it does filter out those who do not meet the criteria. Please note that the -filter works on all other attributes, so I can query on other attributes and it does apply the filter with out the need for the where-object statement.

    What I am trying to do is the filter the result before it is brought into my machine to speed up the import data, rather than bring everyone and then filter.

    Hopefully someone has come across this before and is able to provide me with a solution.

    Regards,

    Friday, September 9, 2016 3:21 PM

Answers

  • Hi Jones,

    Welcome to our forum.

    Thank you for your back, I sure I understand your issue correctly. I also do the test that filter work very well.

    Please try to use to following command:

    Get-CsOnlineUser -filter {WhenChanged -gt "08/30/2016"}

    If there are any questions or issues, please be free to let me know and we will pleasure to help you. If the above suggestion are helpful to you, please make it as answer so that someone who has similar issue could find this thread as soon as possible.

    Best Regard,
    Jim Xu
    TechNet Community Support


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Marked as answer by Jim Jones 1 Friday, September 16, 2016 3:47 PM
    Tuesday, September 13, 2016 2:42 AM

All replies

  • Hi Jones,

    Welcome to our forum.

    When you run this command:

    Get-CsOnlineUser -filter {WhenChanged -ge "01/09/2016 00:00:00"}

    It will show that Whenchanged is after January 9, 2016, for example: 2016.1.10. If you want to filter WhenChanged which is before January 9, 2016, for example: 2016.1.8, please run the following command:
     
    Get-CsOnlineUser -filter {WhenChanged -le "01/09/2016 00:00:00"}

    We could run the following command to get whenchanged:

    Get-CsOnlineUser | FL UserPrincipleName,whenchanged

    If there are any questions or issues, please be free to let me know and we will pleasure to help you. If the above suggestion are helpful to you, please make it as answer so that someone who has similar issue could find this thread as soon as possible.

    Best Regard,
    Jim Xu
    TechNet Community Support


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, September 12, 2016 8:38 AM
  • Hi Jim,

    Thanks for your response, however my question around the fact that when I do the filter:

    Get-CsOnlineUser -filter {WhenChanged -ge "01/09/2016 00:00:00"}

    We are not seeing the records that are greater than or equals to that datetime stamp. I am instead getting results of records that are older and also newer to that date.

    So I was wondering is there a particular format that I need to pass in the date value? I.e in American datetime format: MM/dd/yyyy or can it passed in UK format dd/MM/yyyy? Or does it have to passed in format of what we do in on-prem AD converting the date/time value to filetime value: (get-date "01/09/2016 00:00:00").ToFileTime()

    Regards,

    J

    Monday, September 12, 2016 9:19 AM
  • Hi Jones,

    Welcome to our forum.

    Thank you for your back, I sure I understand your issue correctly. I also do the test that filter work very well.

    Please try to use to following command:

    Get-CsOnlineUser -filter {WhenChanged -gt "08/30/2016"}

    If there are any questions or issues, please be free to let me know and we will pleasure to help you. If the above suggestion are helpful to you, please make it as answer so that someone who has similar issue could find this thread as soon as possible.

    Best Regard,
    Jim Xu
    TechNet Community Support


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Marked as answer by Jim Jones 1 Friday, September 16, 2016 3:47 PM
    Tuesday, September 13, 2016 2:42 AM
  • Thanks Jim that solved it, seems we cannot use the time as part filter and it had to be in American format.

    Regards,

    J

    Friday, September 16, 2016 3:48 PM