How to get the list of Office 365 licenced users from a specific Active Directory group?

Olevo
Olevo used Ask the Experts™
on
Could you please tell how to get the list of all/unlicensed/licensed users from a specific Active Directory group? I’m guessing that I need to pipe ‘Get-MsolGroupMember’ to (or vice versa) ‘Get-MsolUser’ to get the list of all users from AD group?

Additional request, if the user in AD group Office 365 licensed already I would like to know subscriptions and which services within that subscription he/she can use?    

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
It's best to compare the objects directly, as you might have some cases for which the on-prem user is not synced to the cloud, or the UPNs dont match, etc. Load both the AD and WAAD modules, expand the group membership and for each member get the licensing info from WAAD.

The below will give you status on the individual service:

(Get-MsolUser -UserPrincipalName user@domain.com).licenses.servicestatus

Open in new window


There's a sample script here, just add the AD part: https://gallery.technet.microsoft.com/scriptcenter/Export-a-Licence-b200ca2a

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial