How to set OneDrive for Business Storage Quota using PowerShell
#Step1: Get values for input parameters
$Fulldomain="tenantname.onmicrosoft.com"
$Quota="4096"
#Step2: Connect to SharePoint Online and MsolService
$credential = get-credential
Connect-SPOService -Url “https://tenantname-admin.sharepoint.com/” -Credential $credential
Connect-MsolService -Credential $credential
#Step3: Set OneDrive Storage Quota for all Office 365 Users
$users=Get-MsolUser
$users | Foreach-Object{
$user=$_
$username=($user.userprincipalname –Split “@”)[0]
$Dname=($Fulldomain -Split "\.")
If($Dname[2] -ne $null)
{
$Firstname=$Dname[0]
$Secondname=$Dname[1]
$thirdname=$Dname[2]
$sitename= "https://"+$Firstname+"-my.sharepoint.com/personal/"+$username+"_"+$Firstname+"_"+$Secondname+"_"+$thirdname
}
Else
{
$Firstname=$Dname[0]
$Secondname=$Dname[1]
$sitename= "https://"+$Firstname+"-my.sharepoint.com/personal/"+$username+"_"+$Firstname+"_"+$Secondname
}
Set-SPOSite –Identity “$sitename” -StorageQuota $Quota
}