Showing posts with label PowerShell Script to get list of Office 365 Groups. Show all posts
Showing posts with label PowerShell Script to get list of Office 365 Groups. Show all posts

Friday, November 30, 2018

PowerShell Script to get list of Office 365 Groups

PowerShell script to get list of Office 365 Groups within your Tenant

$creds = Get-Credential
Write-Host "--- Connecting to Exchange Online Service"
$ExchOnlineSession= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Creds -Authentication Basic -AllowRedirection
Import-PSSession $ExchOnlineSession
write-host "--- Exchange Session Imported successfully"
Get-UnifiedGroup | Select-Object DisplayName,ManagedBy,AccessType | Export-Csv -Path "Office365Groups.csv"

You must be a Office 365 global administrator to run the cmdlet.

The Get-Credential cmdlet creates a credential object for a specified user name and password.
The New-PSSession cmdlet creates a PowerShell session (PSSession) on a local or remote computer.
The Get-UnifiedGroup cmdlet to view Office 365 Groups in your cloud-based organization. To view members, owners and subscribers for Office 365 Groups