Office 365 How to change Storage Quota in OneDrive for Business (II)!

This time I’m sharing a new script where I show how to change the storage quota recursively for all ODFB sites in an Office 365 tenant. You can download the script from the following link: How to update the quota storage for all the ODFB sites in an Office 365 tenant

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

# Script that allows to set the quota storage for the ODFB assigned to each user 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.

#  -> $iODFBQuota: Quota to be set for ODFB.

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

 

$host.Runspace.ThreadOptions = "ReuseThread"

 

#Definition of the function that sets the quota storage for all the ODFBs in an Office 365 tenant

function Set-OneDriveFBQuotaStorage

{

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

    try

    {    

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

        Write-Host "Setting the Quota Storage for all the ODFBs 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{                        

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

                        Set-SPOSite –Identity $sODFBSite –StorageQuota $iODFBQuota

                        Write-Host "Storage Quota updated for: $sODFBSite"  -ForegroundColor Green  

               

                    }catch{

                        Write-Host "ODFB site for" + $spoUser.UserPrincipalName + " doesn't exist. Storage Quota not updated" -ForegroundColor Yellow            

                    }

                }

            }

        }

    }

    catch [System.Exception]

    {

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

    }    

}

 

#Required parameters

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

$sMessage="Introduce your SPO Credentials"

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

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

$iODFBQuota=512000

 

Set-OneDriveFBQuotaStorage -sUserName $sUserName -sMessage $sMessage -sSPOAdminCenterUrl $sSPOAdminCenterUrl -sSPOODFBHostUrl $sSPOODFBHostUrl -iODFBQuota $iODFBQuota

Office 365: Como cambiar la cuota de almacenamiento en OneDrive for Business (II)!

En esta ocasión, os comparto como cambiar la cuota de almacenamiento de forma recursiva para todos los sitios de ODFB de un tenant de Office 365. El script para realizar dicho cambio, os lo podéis descargar desde el siguiente enlace: How to update the quota storage for all the ODFB sites in an Office 365 tenant

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

# Script that allows to set the quota storage for the ODFB assigned to each user 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.

#  -> $iODFBQuota: Quota to be set for ODFB.

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

 

$host.Runspace.ThreadOptions = "ReuseThread"

 

#Definition of the function that sets the quota storage for all the ODFBs in an Office 365 tenant

function Set-OneDriveFBQuotaStorage

{

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

    try

    {    

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

        Write-Host "Setting the Quota Storage for all the ODFBs 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{                        

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

                        Set-SPOSite –Identity $sODFBSite –StorageQuota $iODFBQuota

                        Write-Host "Storage Quota updated for: $sODFBSite"  -ForegroundColor Green  

               

                    }catch{

                        Write-Host "ODFB site for" + $spoUser.UserPrincipalName + " doesn't exist. Storage Quota not updated" -ForegroundColor Yellow            

                    }

                }

            }

        }

    }

    catch [System.Exception]

    {

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

    }    

}

 

#Required parameters

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

$sMessage="Introduce your SPO Credentials"

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

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

$iODFBQuota=512000

 

Set-OneDriveFBQuotaStorage -sUserName $sUserName -sMessage $sMessage -sSPOAdminCenterUrl $sSPOAdminCenterUrl -sSPOODFBHostUrl $sSPOODFBHostUrl -iODFBQuota $iODFBQuota

[Off Topic]: Do you like technology and photography? Then CloudShare gives you the opportunity to win a $1500 prize!!

If you are an IT Pro and you love photography, then thanks to CloudShare you will have the opportunity to win a $1500 prize as part of contest where CloudShare is celebrating that the first electronic computer was built 70 years ago. If you want to participate in this contest, please read carefully the rules defined by CloudShare’s team here: http://info.cloudshare.com/celebrate

[Off Topic]: ¿Te gusta la tecnología y la Fotografía? CloudShare te da la oportunidad de ganar $ 1500

Si te gusta la fotografía y la tecnología de servidores, gracias a CloudShare tendrás la oportunidad de ganar un premio de $1500 como parte de un concurso en el que se celebran los 70 años desde que se construyó el primer ordenador electrónico. Las bases del concurso son realmente sencillas y las puedes encontrar aquí: http://info.cloudshare.com/celebrate