Share via

Powershell: Specific Get-CsOnlineUser command won't work

Anonymous
2022-03-01T14:46:04+00:00

I am trying to fetch details of a user using Teams Phone Number using command below. It was working for me until a week ago. There is no error. it just won't return any results.

Get-CsOnlineUser | select SipAddress,HostedVoiceMail,EnterpriseVoiceEnabled,LineURi,OnlineVoiceRoutingPolicy | where {$_.LineURi -like “tel:+44XXXXXXX”}

Another Get-CsOnlineUser command (PFB) that i use frequently works fine for me.

**Get-csonlineuser -identity ****@company.com

I have tried to even remove modules and install, but same issue. It works for my colleagues. Is there any alternate command I can use or something else I can try?

Microsoft Teams | Microsoft Teams for business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2022-06-23T14:51:35+00:00

    There are LOTS of problems with how Get-CsOnlineUser functions now compared to earlier versions of the MicrosoftTeams module. I'd say 80+% of the data returned is now missing. I can tell from previous export file sizes (i.e. Get-CsOnlineUser -ResultSize Unlimited | Export-Csv -Path allUsers.csv). Yes, I know the ResultSize parameter no longer takes Unlimited, but I can use a number large enough to include all my users. My point is that the size of the export is now < 20% the size as before. I'm only scratching the surface of what Microsoft has taken away from us.

    In particular, I noticed Microsoft has killed the use of WhenCreated which is (well, was) EXTREMELY useful for identifying new hires. I had scripts that identified accounts with WhenCreated values in the last 30 days. We could set telephone numbers, policies, etc. based on this subset of users. This is no longer possible. Interestingly, the command "Get-CsOnlineUser -Identity ******@contoso.com" will return a value for WhenCreated. Why can I get this for an individual account but not my result set? Also, Microsoft clobbered the WhenCreated values for existing accounts in Oct/Nov 2021. For example, the WhenCreated value for an account created in July 2021 will list "1/1/0001 12:00:00 AM." If I look at the WhenCreated value for someone added after November 2021, it will show an accurate value. This is a major oversight by Microsoft. They should have preserved this meta data on our accounts. Regardless, I would at least be happy to get the WhenCreated attribute back when I get all my users with Get-CsOnlineUser.

    It's changes like this that actually prevent administrators from updating our modules more often. We are consistently dealing with the changes that completely destroy any scripting/automation we build.

    Was this answer helpful?

    10 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2022-04-07T00:07:54+00:00

    Yes I have the same issue too. Using the filter parameter it executes immediately but produces no result and returns no error.
    Get-CsOnlineUser -Filter {TeamsAppPermissionPolicy -eq "<policy name>"}

    I've tried this in version 4.0.0 and now also 4.1.0 with the same result.

    This has also been raised as an issue here: https://githubhot.com/repo/MicrosoftDocs/office-docs-powershell/issues/9185

    Microsoft - Is there an ETA on resolving this issue? There seem to be a few different issues in the last couple of Teams PS modules.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2022-04-04T06:46:37+00:00

    yes get-csonlineuser -filter { tenantdialplan -eq "xx-yy" } is also not working.. or not giving any result.. something wrong with the PS module..

    only MS can tell us..

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2022-03-02T08:54:51+00:00

    Hello Simbarashe,

    I have not changed anything. No latest updates, atleast not in last two weeks. And the command provided by you is doing the same thing.

    Just forgot one thing. Originally, I was using command below that started the problem.

    Get-CsOnlineUser | select SipAddress,HostedVoiceMail,EnterpriseVoiceEnabled,OnPremLineURI,OnlineVoiceRoutingPolicy | where {$_.OnPremLineURI -like “tel:XXXXXXX”}

    Regards,

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2022-03-01T20:12:44+00:00

    Hi Ankit,

    Greetings

    Thank you for posting on Microsoft Community Forum.

    Did you make any changes prior to the command not working?

    Try this command: Get-CsOnlineUser | Where-Object  { $_.LineURI -notlike $null } | select UserPrincipalName, LineURI

    Let us know the result.

    Kind regards,

    Simbarashe

    Was this answer helpful?

    0 comments No comments