Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

Get Created Date of Microsoft 365 Groups Using Microsoft Graph

August 13, 2022
in Blog, Microsoft Graph, Powershell
0
ADVERTISEMENT

Table of Contents

This article will show you how to get the creation date of all your Azure Active Directory groups using a PowerShell script. This is important for auditing purposes and can be used in other scripts to remove any groups that were created after a certain date.

Connect to Microsoft Graph PowerShell

To perform this task, you need install Microsoft Graph PowerShell modules before you can connect to Microsoft Graph API.

1. Before you begin, let’s install the modules following this article.

2. Connect to Microsoft Graph using required scope then sign-in using a global admin account.

Connect-MgGraph -Scope Group.Read.All

3. Run the following script to get the CreatedDateTime of all Microsoft 365 groups in a tenant.

$Report = @()
$Groups = Get-MgGroup -All
foreach ($Group in $Groups) {

    $ObjReport = [PSCustomObject]@{
    DisplayName = $Group.DisplayName    
    Mail     = $Group.Mail
    CreationDate  = $Group.CreatedDateTime
    }

$Report += $ObjReport

}

$Report | Format-Table
$Report | Format-Table

DisplayName Mail                            CreationDate
----------- ----                            ------------
Finance     [email protected]            7/25/2022 3:33:15 PM
M365G       [email protected]              7/18/2022 3:06:48 PM
SSPS        [email protected]               8/8/2022 7:13:41 AM
IT          [email protected]                 8/4/2022 2:24:52 PM
Bon Ben     [email protected]          7/25/2022 2:08:50 PM
Bon Ben     [email protected] 7/3/2022 4:30:40 AM
DL1         [email protected]                7/18/2022 3:11:24 PM
Rest of R&D [email protected]               7/26/2022 4:08:17 AM
R&D         [email protected]                7/26/2022 4:05:59 AM

You can export the results output to a csv file using following command:

$Report | Export-Csv C:\Report_GroupCreatedDate.csv -Nti
Bg1633

Get CeatedDate for a single group

In some cases, you just need get the creation date for a single group only.

1. First, run Get-MgGroup command to find out the group ids.

Get-MgGroup -All

Id                                   DisplayName Description                                                   GroupTypes AccessType
--                                   ----------- -----------                                                   ---------- ----------
181b9ed2-ecf8-49da-bca1-7088af72251f Finance                                                                   {Unified}
1d60a3e4-04ad-4631-bcca-4e5c8d3a6a81 M365G       M365G                                                         {Unified}
43678fdb-2e72-410d-807c-1ee4f89628ef SSPS        SSPS                                                          {Unified}
74029cc4-4776-43ad-9fbd-946ee7ee040d IT                                                                        {Unified}
76c65d3f-4baf-47d2-941f-769d3fed9e0e Bon Ben     Check here for organization announcements and important info. {Unified}
7fa305ba-61ef-4340-9d71-0ff9fa79192f Bon Ben     Bon Ben                                                       {Unified}
a4bb6c1d-d485-484b-87e6-bfb298abb3fd DL1         DL1                                                           {}
c00c4ca7-cb70-407c-868c-5914b8a31578 Rest of R&D Rest of R&D                                                   {Unified}
c16931e9-4771-442d-af64-389b3ea06244 R&D         R&D                                                           {Unified}

Or you can run the following command to get all groups whose display name contains ‘Finance‘.

Get-MgGroup -All -ConsistencyLevel eventual -Count GroupCount -Search '"Displayname:Finance"'

Id                                   DisplayName Description GroupTypes AccessType
--                                   ----------- ----------- ---------- ----------
181b9ed2-ecf8-49da-bca1-7088af72251f Finance                 {Unified}

2. Finally, run the following command to export the CreatedDate of a group.

(Get-MgGroup -GroupId 181b9ed2-ecf8-49da-bca1-7088af72251f).CreatedDateTime

Monday, July 25, 2022 3:33:15 PM
ADVERTISEMENT
5/5 - (4 votes)
Previous Post

Get-MgUser Shows Only 100 Entries How Can I Get all Users

Next Post

Graph PowerShell: Export Created Date of Microsoft 365 Groups

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory