Office 365: How to get the storage being used in ODFB by using PowerShell!

This time I’m sharing a new script that allows to get the storage being used in OneDrive For Business (ODFB) for every user in a Office 365 tenant. You can download the script from the following link: How to get all the space used in ODFB for each user in an Office 365 tenant

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

# Script that allows to get the storage space being used in ODFB for everyuser 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

#  -> $sSPOODFBHostUrl: SharePoint ODFB Host URL

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

 

 

 

$host.Runspace.ThreadOptions = "ReuseThread"

 

#Definition of the function that gets the storage space being used in ODFB for everyuser in an Office 365 tenant

function Get-OneDriveFBUsedSpace

{

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

    try

    {    

        Write-Host "----------------------------------------------------------------------------------"  -foregroundcolor Green

        Write-Host "Getting all storage space being used by end users in ODFB in an Office 365 tenant" -foregroundcolor Green

        Write-Host "----------------------------------------------------------------------------------"  -foregroundcolor Green

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

        Connect-MsolService -Credential $msolCred

        Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolCred 

        $spoUsers=Get-MsolUser        

        ForEach ($spoUser in $spoUsers){

            ForEach ($O365Plan in $spoUser.Licenses.ServiceStatus){

                if (($O365Plan.servicePlan.servicename -like 'SharepointEnterprise') -and $O365Plan.ProvisioningStatus -eq 'Success')

                {                           

                    try{                        

                        $spoODFBUrl=$sSPOODFBHostUrl + $spoUser.UserPrincipalName.Replace(".","_").Replace("@","_")

                        $spoODFB=Get-SPOSite -Identity $spoODFBUrl

                        $spoODFBUsedSpace=$spoODFB.StorageUsageCurrent

                        Write-Host "ODFB Site: " $spoUser.UserPrincipalName " - Storage (MB): " $spoODFBUsedSpace " MB"     

               

                    }catch{

                        [string]::Format("{0},N/A",$spoUser.UserPrincipalName)

                    }

                }

            }

        }

    }

    catch [System.Exception]

    {

        write-host -f red $_.Exception.ToString()   

    }    

}

 

#Connection to Office 365

$sUserName="<Office365User>@<Office365Domain>"

$sMessage="Introduce your SPO Credentials"

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

$sSPOODFBHostUrl="https://<Office365Domain>-my.sharepoint.com/personal/"

 

Get-OneDriveFBUsedSpace -sUserName $sUserName -sMessage $sMessage -sSPOAdminCenterUrl $sSPOAdminCenterUrl -sSPOODFBHostUrl $sSPOODFBHostUrl

Bellow you can find the output generated once you execute the script in PowerShell ISE:

image

Office 365: Como obtener el espacio usado en ODFB por medio de PowerShell!

En esta ocasión os dejo un nuevo script que permite obtener el espacio utilizado a nivel de OneDrive For Business (ODFB) para cada usuario de un tenant de Office 365 que esté haciendo uso de ODFB. Podéis descargaros el script desde el siguiente enlace: How to get all the space used in ODFB for each user in an Office 365 tenant

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

# Script that allows to get the storage space being used in ODFB for everyuser 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

#  -> $sSPOODFBHostUrl: SharePoint ODFB Host URL

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

 

 

 

$host.Runspace.ThreadOptions = "ReuseThread"

 

#Definition of the function that gets the storage space being used in ODFB for everyuser in an Office 365 tenant

function Get-OneDriveFBUsedSpace

{

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

    try

    {    

        Write-Host "----------------------------------------------------------------------------------"  -foregroundcolor Green

        Write-Host "Getting all storage space being used by end users in ODFB in an Office 365 tenant" -foregroundcolor Green

        Write-Host "----------------------------------------------------------------------------------"  -foregroundcolor Green

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

        Connect-MsolService -Credential $msolCred

        Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolCred 

        $spoUsers=Get-MsolUser        

        ForEach ($spoUser in $spoUsers){

            ForEach ($O365Plan in $spoUser.Licenses.ServiceStatus){

                if (($O365Plan.servicePlan.servicename -like 'SharepointEnterprise') -and $O365Plan.ProvisioningStatus -eq 'Success')

                {                           

                    try{                        

                        $spoODFBUrl=$sSPOODFBHostUrl + $spoUser.UserPrincipalName.Replace(".","_").Replace("@","_")

                        $spoODFB=Get-SPOSite -Identity $spoODFBUrl

                        $spoODFBUsedSpace=$spoODFB.StorageUsageCurrent

                        Write-Host "ODFB Site: " $spoUser.UserPrincipalName " - Storage (MB): " $spoODFBUsedSpace " MB"     

               

                    }catch{

                        [string]::Format("{0},N/A",$spoUser.UserPrincipalName)

                    }

                }

            }

        }

    }

    catch [System.Exception]

    {

        write-host -f red $_.Exception.ToString()   

    }    

}

 

#Connection to Office 365

$sUserName="<Office365User>@<Office365Domain>"

$sMessage="Introduce your SPO Credentials"

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

$sSPOODFBHostUrl="https://<Office365Domain>-my.sharepoint.com/personal/"

 

Get-OneDriveFBUsedSpace -sUserName $sUserName -sMessage $sMessage -sSPOAdminCenterUrl $sSPOAdminCenterUrl -sSPOODFBHostUrl $sSPOODFBHostUrl

Y la salida correspondiente por pantalla es la que se muestra a continuación:

image

SharePoint 2013 & Office 365: Resumen de posts (LXVIII)!

Como siempre, después del recopilatorio de enlaces interesantes, es momento del resumen de artículos publicados en este blog durante el mes de junio.

Desarrollo

IT

Office 365

Otros

SharePoint & Office 365: Compilation of interesting links (VII)!

Every month I use to share all the interesting links and resources I have found about the SharePoint and Office 365 platforms during the previous month. As you can see, this is the seventh compilation of interesting links I publish in English and I hope you find all of them useful.

Development

IT Pro

Office 365

SharePoint 2013 & Office 365: Recopilatorio de enlaces interesantes (LXVIII)!

Una vez más, os dejo un nuevo recopilatorio de recursos interesantes sobre SharePoint 2013 y sobre todo sobre Office 365.

Desarrollo

IT

Office 365

Office 365: Is it possible to search Group files from a regular SharePoint Online Team Site?

This was a question done the other day in the Office 365 Yammer Network…and the answer is yes as I will show you in this post:

  • First, we have to check that we have some file stored in the site related to any of our Office 365 Groups.
  • After that, just simply search one of this files from any SharePoint Team site in your tenant and you will see how the file is found by the search engine and displayed in the search results.
image image

Side Note: Group Files are currently only searchable for public Groups.

Office 365: ¿Se pueden buscar archivos de Grupos de Office 365 desde sitios de grupo de SharePoint Online?

Esta es una pregunta que el otro día se hacia en la Office 365 Yammer Network y la respuesta a la misma es que sí…y para demostrarlo:

  • Comprobamos en primer lugar que en uno cualquiera de nuestros grupos tenemos documentación subida.
  • A continuación desde un sitio de grupo cualquiera buscamos uno de estos archivos y veremos como se muestra en el resultado de las búsquedas.
image image

Nota: Los archivos de Grupos sólo son buscables por el momento para Grupos públicos.