Find Microsoft 365 Group Storage Size Report

Find Microsoft 365 Group Storage Size Report
This commit is contained in:
AdminDroid 2023-10-06 17:54:30 +05:30
parent 87245ab6d4
commit 2bc6941269

View File

@ -4,6 +4,16 @@ Name: Get storage used by Office 365 groups
Description: This script find Office 365 groups' size and exports the report to CSV file Description: This script find Office 365 groups' size and exports the report to CSV file
Version: 1.0 Version: 1.0
Website: o365reports.com Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1. The script uses modern authentication to connect to Exchange Online.
2. The script can be executed withMFA enabled account too.
3. Automatically install the EXO V2 and SharePoint PnP PowerShell module (if not installed already) upon your confirmation.
4. Credentials are passed as parameters (Scheduler-friendly), so worry not! i.e., credentials can be passed as parameters rather than being saved inside the script.
5. Exports the report result toa CSV file.
6. Lists the details of the storage used in each Office 365 group.
For detailed script execution: https://o365reports.com/2022/05/18/get-the-storage-used-by-office-365-groups-using-powershell/ For detailed script execution: https://o365reports.com/2022/05/18/get-the-storage-used-by-office-365-groups-using-powershell/
============================================================================================ ============================================================================================
#> #>
@ -94,7 +104,7 @@ else
#Get storage used by office 365 groups... #Get storage used by office 365 groups...
Write-Host "Getting office 365 groups storage..." Write-Host "Getting office 365 groups storage..."`n
$OutputCsv=".\Office365GroupsStorageSizeReport_$((Get-Date -format MMM-dd` hh-mm` tt).ToString()).csv" $OutputCsv=".\Office365GroupsStorageSizeReport_$((Get-Date -format MMM-dd` hh-mm` tt).ToString()).csv"
#Getting all sites which have an underlying Microsoft 365 group #Getting all sites which have an underlying Microsoft 365 group
$GroupSites = Get-PnPTenantSite -GroupIdDefined $true | Select-Object StorageUsageCurrent, StorageQuota, Url $GroupSites = Get-PnPTenantSite -GroupIdDefined $true | Select-Object StorageUsageCurrent, StorageQuota, Url
@ -122,7 +132,7 @@ Get-UnifiedGroup -ResultSize unlimited | ForEach-Object {
#Groupcount details #Groupcount details
if($GroupCount -ne 0) if($GroupCount -ne 0)
{ {
Write-Host "$GroupCount Office 365 groups found in this organization" Write-Host "$GroupCount Office 365 groups found in this organization."`n
} }
else else
{ {
@ -133,7 +143,10 @@ else
#Open output file after execution #Open output file after execution
if((Test-Path -Path $OutputCsv) -eq "True") if((Test-Path -Path $OutputCsv) -eq "True")
{ {
Write-Host "The office 365 groups storage report available in : $OutputCsv" -ForegroundColor Green Write-Host " The office 365 groups storage report available in:" -NoNewline -ForegroundColor Yellow; Write-Host $OutputCsv
Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green
Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline;
Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n
$Prompt = New-Object -ComObject wscript.shell $Prompt = New-Object -ComObject wscript.shell
$UserInput = $Prompt.popup("Do you want to open output file?",` 0,"Open Output File",4) $UserInput = $Prompt.popup("Do you want to open output file?",` 0,"Open Output File",4)
If ($UserInput -eq 6) If ($UserInput -eq 6)