Office 365: How to get the storage used by an Office 365 Group(II)!

This time I’m sharing a PowerShell script that allows to get the storage used by all the Office 365 Groups in an Office 365 Group. You can download the script from the following Url: How to get the storage used in all the Office 365 Groups in Office 365

############################################################################################################################################

# Script that allows to  get the storage space being used by all the Office 365 Groups in an Office 365 tenant

# Required Parameters:

#  -> $sUserName: User Name to connect to the SharePoint Admin Center.

#  -> $sMessage: Message to show in the user credentials prompt.

#  -> $sSPOAdminCenterUrl: SharePoint Admin Center Url.

#  -> $smsolCred: Office 365 Credentials.

############################################################################################################################################

 

$host.Runspace.ThreadOptions = "ReuseThread"

 

#Definition of the function that gets the storage space being used by all the Office 365 Groups in an Office 365 tenant

function Get-AllOffice365GroupsUsedSpace

{

    param ($sUserName,$sMessage,$sSPOAdminCenterUrl,$msolCred)

    try

    {    

        Write-Host "----------------------------------------------------------------------------------"  -ForegroundColor Green

        Write-Host "Getting the storage space being used by all the Office 365 Groups in an Office 365 tenant" -ForegroundColor Green

        Write-Host "----------------------------------------------------------------------------------"  -ForegroundColor Green             

        Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolCred

        $spoO365GroupSites=Get-UnifiedGroup

        ForEach ($spoO365GroupSite in $spoO365GroupSites){

            If($spoO365GroupSite.SharePointSiteUrl -ne $null)

            {

                $spoO365GroupFilesSite=Get-SPOSite -Identity $spoO365GroupSite.SharePointSiteUrl

                $spoO365GroupFilesUsedSpace=$spoO365GroupFilesSite.StorageUsageCurrent

                Write-Host "Office 365 Group Files Url: " $spoO365GroupSite.SharePointSiteUrl " - Storage being used (MB): " $spoO365GroupFilesUsedSpace " MB"                   

            }     

        }

    }

    catch [System.Exception]

    {

        write-host -ForegroundColor Red $_.Exception.ToString()   

    }    

}

 

#Office 365 Groups cmdlets

$sUserName="<O365User>@<O365Domain>.onmicrosoft.com"

$sMessage="Introduce your SPO Credentials"

$msolCred = Get-Credential -UserName $sUserName -Message $sMessage

$msolSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $msolCred -Authentication Basic -AllowRedirection

Import-PSSession $msolSession

$sSPOAdminCenterUrl="https://<O365Domain>-admin.sharepoint.com/"

 

Get-AllOffice365GroupsUsedSpace -sUserName $sUserName -sMessage $sMessage -sSPOAdminCenterUrl $sSPOAdminCenterUrl -msolCred $msolCred

And bellow you can see the results you get once you execute the Script in PowerShell ISE or in Visual Studio:

image

Anuncios

Un pensamiento en “Office 365: How to get the storage used by an Office 365 Group(II)!

  1. Pingback: SharePoint & Office 365: Resumen de posts (V)! | Pasión por la tecnología...

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s