Share via

Get CSV for Unlicensed users with ImmutableID

Anonymous
2023-08-22T13:28:07+00:00

Someone tell me that I'm simply doing something wrong. My objective is to get a CSV with all M365 users that are unlicensed (cause any of our clients licensed users are still synced from AD), DO still have the ImmutableID field filled in (even though they're cloud only), and they are not external users. So far I've connected to MSOL PowerShell and used the following:

Get-MsolUser -All | Where-Object {($_.ImmutableID -ne $null) -and ($_.IsLicensed -eq $False)} | Select UserPrincipalName, ImmutableID, isLicensed

This returns me a list of unlicensed users with the ImmutableID field and UPN, so I see cloud only users even though some of them still have an ImmutableID linking them to an on-prem user object (I.E some of them return ******@clientdomain.com, some return a random string of characters linking them to an on-prem user). I tried to append:

-and ($_.ImmutableID -NotLike "clientdomain.com")

-and ($_.ImmutableID -NotContains "clientdomain.com")

So that I could filter out external users and cloud only internal users with a cloud only style ImmutableID, but I still get users with a cloud only style ImmutableID and external users. Am I missing something?

New thought as I'm writing... yes I appended:

| Export-Csv C:\Temp\filename.csv at the end.

Microsoft 365 and Office | Install, redeem, activate | Other | 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

3 answers

Sort by: Most helpful
  1. Anonymous
    2023-08-25T01:26:15+00:00

    Hi,

    I am glad to know that you find the option that resolved the problem.

    Thank you as well for sharing the information that fixed this issue. This will be used as referene by other community folks who will encounter this type of issue in the future.

    For future concerns, do not hesitate to submit/create a new thread in the community.

    Sincerely,

    Leonardo_Y

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-08-23T01:44:53+00:00

    Hi Leonardo_Y,

    I ended up using the 'notmach' parameter and was able to resolve the issue, thanks!

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-08-22T23:07:47+00:00

    Hi,

    Thank you for posting in Microsoft Community.

    I understand you need help getting a CSV of all M365 users that are unlicensed listed on your Azure Directory. If you think misunderstood your concern, please let me know.

    Based on your description, its best to consult this directly to our Azure Support team - Contact Microsoft Azure Support - Microsoft Support. Additionally, this type of topics are normally discussed in our sister community forum called Microsoft Q&A.

    Follow the guide below, if you need further isolation of the issue, you can post your concern to Microsoft Q&A community forum.

    Sincerely,

    Leonardo_Y

    Was this answer helpful?

    0 comments No comments