Skip to content

Commit

Permalink
Fix script to pull proper EXO module
Browse files Browse the repository at this point in the history
Fix script to use proper EXO module for Unified Group commandlets.  Also modify properties returned from members to be more readable.
  • Loading branch information
BrianTJackett authored Feb 10, 2020
1 parent 56b7559 commit 2183b1e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Office 365/PS_Get_O365_Group_Members.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
############################################################################################################################################
############################################################################################################################################
# Script that allows to get the members for each Office 365 Group defined in an Office 365 tenant.
# Required Parameters: N/A.
############################################################################################################################################
Expand All @@ -19,8 +19,7 @@ function Get-O365Members
foreach ($O365Group in $O365Groups)
{
Write-Host "Members of Group: " $O365Group.DisplayName -ForegroundColor Green
Get-UnifiedGroupLinks –Identity $O365Group.Identity –LinkType Members
Write-Host
Get-UnifiedGroupLinks –Identity $O365Group.Identity –LinkType Members | Select-Object -Property DisplayName, PrimarySmtpAddress
}
}
catch [System.Exception]
Expand All @@ -34,8 +33,8 @@ $sUserName="<Your_Office365_Admin_Account>"
$sMessage="Introduce your Office 365 Credentials"
#Connection to Office 365
$msolCred = Get-Credential -UserName $sUserName -Message $sMessage
Connect-MsolService -credential $msolCred
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $msolCred -Authentication Basic -AllowRedirection
Import-PSSession $Session -AllowClobber

#Getting Groups Information
Get-O365Members

0 comments on commit 2183b1e

Please sign in to comment.