Find All Office 365 Groups using PowerShell

Requirement: Get Office 365 Groups using PowerShell

How to Get Office 365 Groups in Admin Center?
As an admin, you can get office 365 groups through Microsoft 365 admin center.
  • Login to the Microsoft 365 Admin Center site: https://admin.microsoft.com
  • Expand "Groups" and Click on "Groups" in the left navigation. 
  • In the "View" drop-down, Select "Office 365". That list's all Office 365 groups to the page.
    How to Get Office 365 Groups

Get Office 365 Group Details using PowerShell
Use Get-UnifiedGroup cmdlet to get all Office 365 groups in Office 365.
#Get Credentials to connect
$Credential = Get-Credential
 
#Create the session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
           -Credential $Credential -Authentication Basic -AllowRedirection
 
#Import the session
Import-PSSession $Session -DisableNameChecking

#Get all Office 365 Group
Get-UnifiedGroup

#Remove the session 
Remove-PSSession $Session
This cmdlet retrieves all Office 365 groups
get office 365 group using powershell
You may query specific properties of the Office 365 group by,
Get-UnifiedGroup | Format-Table Alias, WhenCreated, WhenChanged, SharePointSiteUrl

Similarly, to get office 365 group id using PowerShell, use:
Get-UnifiedGroup -Identity "Marketing" | Select ID

Export Office 365 Groups using PowerShell
Get-UnifiedGroup | Select Guid,DisplayName,Alias, AccessType,ManagedBy,WhenCreated | Export-Csv -Path "C:\Temp\Groups.csv" -NoTypeInformation
This PowerShell generates a CSV file as:
Export Office 365 groups to CSV using powershell

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.