Quota management for OneDrive for business is back

An year back, Microsoft announced 1TB of OneDrive for Business storage for its Office 365 business plans. The news was quickly followed by similar announcement for the consumer O365 plans, and later by announcing Unlimited storage for OneDrive for Business. As the quota for ODFB was no longer counted against the tenant storage quota, Microsoft decided to remove the quota management controls we previously had in the SharePoint Online Administrator center.

Following on feedback from their Enterprise customers, they have now revised their stance and will offer the option to control ODFB quotas back. At present, this is only possible via the SPO PowerShell module, but hopefully the GUI option will be back as well.

Anyway, in case you are interested in setting the quotas in bulk, you can use the script below. It requires the CSOM binaries to be installed in order to enumerate all provisioned ODFB sites. Alternatively, you can try to get this via enumerating all users for the ODFB root SC via, but the CSOM method is much cleaner. Once we have the list of provisioned sites, we can run the Set-SpoSite cmdlet against them to set the quota.

Add-Type –Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”

Add-Type –Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”

Add-Type –Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.UserProfiles.dll”

$MySiteURL= “https://tenant-my.sharepoint.com”
$credentials = Get-Credential
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($MySiteURL)

$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.UserName,$credentials.Password)$Context.Credentials = $Creds
$Users = $Context.Web.SiteUsers
$Context.Load($Users)
$Context.ExecuteQuery()

$peopleManager = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($Context)
$members = New-Object System.Collections.ArrayList
$i = 0
foreach ($User in $Users) {
$userProfile = $peopleManager.GetPropertiesFor($user.LoginName)

$Context.Load($userProfile)
$Context.ExecuteQuery()
if ($userProfile.Email -ne $null -and $userProfile.UserProfileProperties.PersonalSpace -ne “”) {

$obj = New-Object PSObject

Add-Member -InputObject $obj -MemberType NoteProperty -Name "EmailAddress" -Value $userProfile.Email
Add-Member -InputObject $obj -MemberType NoteProperty -Name "ODFBSite" -Value
$userProfile.UserProfileProperties.PersonalSpace
$members.Add($obj) > $Null

$i++

}

}

$members | % { Set-SPOSite -Identity $($MySiteURL + $_.ODFBSite).Trim("/") -StorageQuota 1024000 }
This entry was posted in Office 365, OneDrive for Business. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *