SOLVED
Home

Powershell command to get all users with specific service plan

%3CLINGO-SUB%20id%3D%22lingo-sub-907488%22%20slang%3D%22en-US%22%3EPowershell%20command%20to%20get%20all%20users%20with%20specific%20service%20plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-907488%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20looking%20for%20a%20powershell%20command%20to%20get%20list%20of%20all%20users%20with%20specific%20plan%20in%20Office%20365.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EE.g.%20I%20need%20to%20get%20all%20users%20with%20Teams%20enabled%20in%20Office%20365.%20I%20tried%20the%20following%20command%20and%20it%20didn't%20return%20anything.%3C%2FP%3E%3CP%3EGet-MsolUser%20-All%20%7C%20Where-Object%20%7B(%24_.licenses).AccountSkuId.ServicePlan%20-match%20%22Teams1%22%7D%20%7C%20select%20DisplayName%2C%20UserPrincipalName%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can%20run%20following%20command%20to%20find%20users%20with%20specific%20license%2C%20e.g.%20users%20with%20Office%20365%20E3%20license%2C%20however%20still%20no%20success%20with%20specific%20plans%20inside%20E3%20license%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGet-MsolUser%20-All%20%7C%20Where-Object%20%7B(%24_.licenses).AccountSkuId%20-match%20%22ENTERPRISEPACK%22%7D%20%7C%20select%20DisplayName%2C%20UserPrincipalName%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%2C%20will%20be%20greatly%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20Advance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-907488%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%20Powershell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-907991%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20command%20to%20get%20all%20users%20with%20specific%20service%20plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-907991%22%20slang%3D%22en-US%22%3E%3CP%3EAnd%20by%20looking%20did%20you%20mean%20actually%20performing%20a%20search%2C%20as%20I've%20answered%20this%20question%20dozen%20times%20already%3F%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere's%20how%20to%20do%20it%20via%20the%20MSOnline%20cmdlets%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet-MsolUser%20%7C%20%3F%20%7B%24_.Licenses.ServiceStatus%20%7C%20%3F%20%7B%24_.ServicePlan.ServiceName%20-eq%20%22TEAMS1%22%20-and%20%24_.ProvisioningStatus%20-eq%20%22Success%22%7D%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-914617%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20command%20to%20get%20all%20users%20with%20specific%20service%20plan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-914617%22%20slang%3D%22en-US%22%3EThanks%20for%20your%20reply%2C%20Vasil.%20I%20swear%2C%20I%20did%20find%20your%20old%20posts%20and%20executed%20the%20same%20command%20before%2C%20however%2C%20it%20didn't%20work.%20However%2C%20you%20may%20have%20heard%20this%20excuse%20in%20the%20past%2C%20so%20this%20time%20this%20command%20worked.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20again%3C%2FLINGO-BODY%3E
Highlighted
PushpinderRavi
New Contributor

Hi all,

 

I am looking for a powershell command to get list of all users with specific plan in Office 365.

 

E.g. I need to get all users with Teams enabled in Office 365. I tried the following command and it didn't return anything.

Get-MsolUser -All | Where-Object {($_.licenses).AccountSkuId.ServicePlan -match "Teams1"} | select DisplayName, UserPrincipalName

 

I can run following command to find users with specific license, e.g. users with Office 365 E3 license, however still no success with specific plans inside E3 license

 

Get-MsolUser -All | Where-Object {($_.licenses).AccountSkuId -match "ENTERPRISEPACK"} | select DisplayName, UserPrincipalName

 

Any help, will be greatly appreciated.

 

Thanks in Advance.

2 Replies
Solution

And by looking did you mean actually performing a search, as I've answered this question dozen times already? :)

 

Here's how to do it via the MSOnline cmdlets:

 

Get-MsolUser | ? {$_.Licenses.ServiceStatus | ? {$_.ServicePlan.ServiceName -eq "TEAMS1" -and $_.ProvisioningStatus -eq "Success"}}

Thanks for your reply, Vasil. I swear, I did find your old posts and executed the same command before, however, it didn't work. However, you may have heard this excuse in the past, so this time this command worked.

Thanks again
Related Conversations
Extentions Synchronization
Deleted in Discussions on
3 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
9 Replies