You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$owners = Get-MgGroupOwner -GroupId <ID of a Group with one owner>
$owners.Count
$members = Get-MgGroupMember -GroupId <ID of a Group with one member>
$members.Count
Both .Count lines will return 2 instead of 1. .GetType() returns MicrosoftGraphDirectoryObject, and not an array. I'm using $owners.Id.Count and $members.Id.Count to get correct counts in the meantime.
Same for Get-MgDirectoryDeletedItem. The only way I get a usable object I can enumerate against is to run $deletedItems = (Get-MgDirectoryDeletedItem -DirectoryObjectId 'microsoft.graph.group').ToJsonString() | ConvertFrom-Json AB#6870
The text was updated successfully, but these errors were encountered:
joshtransient
changed the title
Get-MgGroupOwner and Get-MgGroupMember don't report the right count when 1 owner/member
Several cmdlets don't report the right count when 1 owner/member
Oct 6, 2020
@joshtransient, @ryanspletzer Thanks for reporting this to us. This is indeed a bug. Count property shouldn't be present when a command returns an object. We will fix this in the next release.
Note to self:
The same should apply to Keys and Values properties.
On both 5.1 and 7, run:
Both .Count lines will return 2 instead of 1.
.GetType()
returns MicrosoftGraphDirectoryObject, and not an array. I'm using$owners.Id.Count
and$members.Id.Count
to get correct counts in the meantime.Same for Get-MgDirectoryDeletedItem. The only way I get a usable object I can enumerate against is to run
$deletedItems = (Get-MgDirectoryDeletedItem -DirectoryObjectId 'microsoft.graph.group').ToJsonString() | ConvertFrom-Json
AB#6870
The text was updated successfully, but these errors were encountered: