Forum Discussion
vvtaz
Feb 03, 2023Copper Contributor
Finding empty azure AD groups of all types.
Trying to find any Azure AD Groups we have with 0 total members. Get-MsolGroup | ? {(Get-MsolGroupMember -GroupObjectId $_.ObjectId).count -eq 0 } This is what i have as reference to go off bu...
- Feb 05, 2023The good old MSOnline cmdlets do not return device objects as members of groups. I wouldn't recommend using the Azure AD module either, as it's going to be deprecated soon. Use the Graph SDK for PowerShell instead, the cmdlet is Get-MgGroupMember.
If you want some ready-to-use script samples, I published these the other day: https://www.michev.info/Blog/Post/4357/report-on-azure-ad-group-members-via-the-graph-api
VasilMichev
Feb 05, 2023MVP
The good old MSOnline cmdlets do not return device objects as members of groups. I wouldn't recommend using the Azure AD module either, as it's going to be deprecated soon. Use the Graph SDK for PowerShell instead, the cmdlet is Get-MgGroupMember.
If you want some ready-to-use script samples, I published these the other day: https://www.michev.info/Blog/Post/4357/report-on-azure-ad-group-members-via-the-graph-api
If you want some ready-to-use script samples, I published these the other day: https://www.michev.info/Blog/Post/4357/report-on-azure-ad-group-members-via-the-graph-api
- vvtazFeb 05, 2023Copper Contributor