Generate Monthly Reports for Newly Created SharePoint Online Sites

Mbongeni Ashley Sibanda 20 Reputation points
2025-01-14T18:54:29.52+00:00

Hello

I am looking for assistance in generating monthly reports of newly created SharePoint Online sites. Specifically, I would like to achieve the following:

Generate a list of all newly created SharePoint Online sites in the last 30 days.

Use PowerShell to automate this process.

I would greatly appreciate it if someone could share a PowerShell script or guidance on how to accomplish this task. Any tips on best practices for scheduling this script to run weekly would also be helpful.

Microsoft 365 and Office | SharePoint | Development
Windows for business | Windows Server | User experience | PowerShell
{count} votes

Answer accepted by question author
  1. Xyza Xue_MSFT 30,241 Reputation points Microsoft External Staff
    2025-01-15T06:19:46.9833333+00:00

    Hi @Ashley S ,

    1.Usually other articles and existing PowerShell scripts solve this by pulling all sites from tenant and then iterating through sites to get only new sites. You can refer to this article:https://github.com/VladilenK/m365-PowerShell/blob/main/reports/SharePoint/Get-NewSites.ps1

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

    That approach is not nice and simply does not work in large environments. The Microsoft Graph API can do this better. It returns result in seconds and you can sort or filter results based on created date. Below is the method:

    https://graph.microsoft.com/v1.0/sites?search=created>=2024-12-15
    
    

    User's image

    2.To automate this process and run the script weekly, you can use Windows Task Scheduler:

    Task scheduler is a Windows-related app, not my field of expertise, how to combine it with the Task Scheduler to achieve automatic upload requires a reply from a Windows expert.

    My suggestion for scheduling this script to run weekly is that you can create a new thread and add a Windows-related tag and seek professional help.

    Hope the above helps.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.