recovering deleted GroupsThe Office 365 Groups report script helps you track new, modified, and deleted Groups in your Office 365 tenant. When the script was first developed there was no method for recovering deleted Groups. That has since been added, along with the Azure AD PowerShell cmdlets to support it.

Right now the PowerShell cmdlet Get-AzureADMSDeletedGroup, which lists soft-deleted Groups that are recoverable for 30 days, is available in the AzureADPreview module. I’ve taken the opportunity to start updating the Office 365 Groups report script to include information about deleted Groups that are still recoverable.

The new script adds two pieces of information:

  • Newly deleted Groups are now listed with the time stamp for when they were deleted. Previously the script could only detect that the Group had been deleted since the last time you ran the script, but not provide a specific time.
  • Recoverable Groups are now listed in a section of the report, including the number of days until they can no longer be recovered.

I’m releasing V1.02 of the script as a beta for now, until the PowerShell cmdlets are released in the Azure AD module, and so that any bugs that come up in the real world can be fixed before then. If you are willing to test it for me and provide feedback, please download this zip file. You’ll also need to install or update the Azure AD Preview module on your computer so that you have at least V2.0.0.127. All other dependencies and usage instructions listed here still apply.

Any feedback from your testing is appreciated, and can be provided in the comments below or by raising an issue on GitHub.

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Chris Cox

    We have a large number of groups I receive when running the script:

    WARNING: By default, only the first 1000 items are returned. Use the ResultSize parameter to specify the number of items returned. To return all items, specify “-ResultSize Unlimited”. Be aware that, depending on th
    e actual number of items, returning all items can take a long time and consume a large amount of memory. Also, we don’t recommend storing the results in a variable. Instead, pipe the results to another task or scrip
    t to perform batch changes.

    1. Chris Cox

      UPDATE: set -ResultSize Unlimited under “Retrieve current list of Groups”

      …..@(Get-UnifiedGroup -ResultSize Unlimited |……

  2. Rajesh

    Hello Paul,

    Do you have a script to find AzureAD Synced users who are not member of a specific group ?

  3. Craig

    FYI Resolve-DnsName is Windows 8 and above.
    [System.Net.Dns]::GetHostAddresses(“server.domain.com”) should be similar for Win 7

    1. Craig

      Actually, I take that back, GetHostAddresses isn’t quite the same in your context. As you’re retrieving the MX record. (should have looked at the code before I posted).

      A quick google suggests there isn’t a simple solution for Win 7 and older.

      1. Paul Cunningham

        Yeah, the solution is to hard code the SMTP server into the XML config file we provide, so the script will just use that instead of trying to find it in DNS.

Leave a Reply