• Home
  • About
  • Blog
  • Training
  • Books
  • Contact
    • Email
    • Facebook
    • Twitter
    • RSS

Practical 365

  • Office 365
  • Exchange 2019
  • Exchange 2016
  • Exchange 2013
  • Hybrid
  • Certificates
  • PowerShell
  • Migration
You are here: Home / Collaboration / Groups / Get-O365GroupReport.ps1 – PowerShell Script to Generate Reports for New, Changed, and Deleted Groups in Office 365

Get-O365GroupReport.ps1 – PowerShell Script to Generate Reports for New, Changed, and Deleted Groups in Office 365

October 20, 2016 by Chris Brown 3 Comments

Office 365 Groups, also known as Unified Groups, provide users with the ability to communicate via email, share files, and collaborate with tools such as OneNote, Teams and Planner.

Although administrators do have some controls that can be applied to the management of Groups, out of the box it is possible for end users to create, modify, and delete their own Groups. For organizations where that freedom is preferred, it's still a good idea to keep an eye on the state of Groups in your tenant in case of misuse.

Get-O365GroupReport.ps1 is a PowerShell script for administrators to generate reports about the Groups in their Office 365 tenant. The script stores information about the Groups that were found in a tenant, and uses that information to determine which groups are new, modified, or deleted since the last report was generated.

get-o365groupreport-sample-report

To install the script:

  1. Download the latest release from the TechNet Script Gallery or from GitHub.
  2. Unzip the files to a folder on the workstation or server where you want to run the script.
  3. Rename Get-O365GroupReport.xml.sample to Get-O365GroupReport.xml
  4. Edit Get-O365GroupReport.xml with appropriate email settings for your environment. If you exclude the SMTP server, the script will send the report email to the first MX record for the domain of the To address.
  5. Run the script using the usage examples below.

You can customize the behavior of the script by editing settings in the Get-O365GroupReport.xml file.

  • HistoryItemsToKeep: defines the number of previous UnifiedGroups.xml files that will be preserved in the \history folder. The default is 10. History files might be useful to you for manual comparisons.
  • EmailOnlyIfChanges: defines whether to send the email report if there are no new, modified, or deleted groups detected. The default is 1, which means the email report will not send if there's no changes. If you prefer to receive the report every time, change the value to 0.

This script can make use of the following functions:

  • Get-StoredCredential
  • Connect-EXOnline

By adding those functions to your PowerShell profile you can streamline the running of Get-O365GroupReport.ps1. Without those functions, you'll need to run the script from an existing PowerShell session that is connected to Exchange Online, or you'll be prompted for credentials to connect to Exchange Online.

Run the script in a PowerShell console.

1
.\Get-O365GroupReport.ps1

Run the script, using a stored credential to connect to Exchange Online.

1
.\Get-O365GroupReport.ps1 -UseCredential admin@tenantname.onmicrosoft.com

Run the script with verbose output.

1
.\Get-O365GroupReport.ps1 -Verbose

Run the script with manual SMTP settings that override the Get-O365GroupReport.xml configuration.

1
.\Get-O365GroupReport.ps1 -MailFrom reports@contoso.com -MailTo you@contoso.com -MailSubject "Your custom subject" -SmtpServer mail.contoso.com

Questions and feedback are welcome in the comments below. If you encounter a bug please let use know in the comments, or by raising an issue on GitHub.

Chris Brown

Chris is a solution architect living in Melbourne, Australia, specializing in Office 365, Amazon/Microsoft public cloud, identity management, and security.

Groups Groups, PowerShell, Reporting, Scripts

Comments

  1. Vinod says

    October 21, 2016 at 1:31 pm

    As Usual one of the best script for O365 Group Inventory.
    Thanks a lot Paul.

    Reply
  2. Caitlin says

    July 31, 2018 at 5:41 am

    How long does this typically take to run? The command ran successfully but I haven’t received the email with the summary.

    Reply
  3. Alex says

    September 17, 2018 at 3:29 am

    Caitlin has a reason. I havent received the email.

    Reply

Leave a Reply Cancel reply

You have to agree to the comment policy.

Recent Articles

  • How to configure custom branding for Office 365 Message Encryption
  • The clock is ticking on Exchange Server 2010
  • How to licence Exchange Hybrid servers
  • How to use the Azure Content Moderator in Office 365
  • Hybrid Agent & Exchange Modern Hybrid now available as a public preview
Practical 365

Training Courses

  • Configuring and Managing Office 365 Security
  • Office 365 Admin Playbook
  • Exchange 2016 Exam 70-345
  • Managing Exchange Mailboxes and Distribution Groups in PowerShell
  • More Training Courses...

Recommended Resources

  • Office 365 Security Resources
  • Office 365 Books
  • Exchange Server Books
  • Exchange Server Migrations
  • Exchange Analyzer
  • Digicert SSL Certificates

About This Site

Practical 365 is a leading site for Office 365 and Exchange Server news, tips and tutorials. Read more...
  • Email
  • Facebook
  • Twitter
  • RSS

Copyright © 2019 Quadrotech Solutions AG · Disclosure · Privacy Policy
Alpenstrasse 15, 6304 Zug, Switzerland

We are an Authorized DigiCert™ SSL Partner.