I need help obtaining the members of groups in the O365 SCC center (connect to IPPSsession)

I keep getting error: Cannot process argument transformation on parameter ‘Identity’. Cannot convert the “System.Collections.ArrayList” value of type “System.Collections.ArrayList” to
type “Microsoft.Exchange.Configuration.Tasks.RoleGroupMemberIdParameter”.

  • CategoryInfo : InvalidData: (:slight_smile: [Get-RoleGroupMember], ParameterBindin…mationException
  • FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-RoleGroupMember
  • PSComputerName : nam03b.ps.compliance.protection.outlook.com

Here is my script:

#get all groups and all members of each group for O365 security and compliance

Write-Verbose "retrieving SCC Roles"$sccrole = @(Get-RoleGroup -ErrorAction Stop)foreach ($sccrole in $sccrole) 

#loop through each SCC role and obtain members 

Write-Verbose "processing $($sccrole.name)"

#get list of members for the roles

$sccrolemember = @(get-rolegroupmember -identity $sccrole.name)foreach ($sccrolemember in $sccrolemember) { Select |"role" = $sccroles.name"display name" $sccrolemembers.name}
Any help would be appreciated!

4 Spice ups

If you post code, please use the ‘Insert Code’ button. Please and thank you!

codebutton_small.png

(Get-DistributionGroup).identity | ForEach-Object{
    $DistributionGroupName = $_
    $DistributionEmail = $_.PrimarySmtpAddress
    Get-DistributionGroupMember -Identity $_ | ForEach-Object{
        [PSCustomObject]@{
            DistributionGroup = $DistributionGroupName
            MemberName = $_.DisplayName
            EmailAddress = $_.PrimarySmtpAddress
            Alias = $_.Alias
            #Other recipient properties here
        }
    }
} | Export-csv $ExportPath\GroupMembers.csv 

1 Spice up