Hi team,
I am trying to get security group from Office 365 using the below powershell script, i am getting only distribution groups only can anyone help me
$mailGroups = Get-DistributionGroup -RecipientTypeDetails SecurityGroup
$Result = @()
$mailGroups | ForEach-Object {
$group = $_
Get-DistributionGroupMember -Identity $group.Identity | ForEach-Object {
$member = $_
$Result += New-Object PSObject -property @{
GroupName = $group.DisplayName
Member = $member.DisplayName
PrimarySmtpAddress = $member.PrimarySmtpAddress
}
}
}
$Result | Select GroupName,Member
Thanks
Vel