On this weblog publish I’ll present you how you can set OneDrive quotas with PowerShell. I’d say right here we go!
First, let’s hook up with SharePoint On-line. Ensure you enter the proper URL and the proper person account.
Set up-Module -Identify Microsoft.On-line.SharePoint.PowerShell -Pressure -AllowClobber
$cred = Get-Credential -Credential patrick@m365ps2022.onmicrosoft.com
Join-SPOService -Url https://m365ps2022-admin.sharepoint.com -Credential $cred
Subsequent, we have to determine the URLs.
# Discover out all OneDrive URLs
$LogFile = [Environment]::GetFolderPath("Desktop") + "OneDriveSites.log"
Get-SPOSite -IncludePersonalSite $true -Restrict all -Filter "Url -like '-my.sharepoint.com/private/'" |
Choose-Object -ExpandProperty Url | Tee-object -FilePath $LogFile
Write-Host "File saved as $($LogFile)."
As soon as we now have the URL, we will use it to set quotas.
# Configure OneDrive Quota per Consumer
$OneDriveSite = "https://m365ps2022-my.sharepoint.com/private/f_bizeps_m365ps2022_onmicrosoft_com"
$OneDriveStorageQuota = "2097152" # MB
$OneDriveStorageQuotaWarningLevel = "1000000" # MB
Set-SPOSite -Identification $OneDriveSite -StorageQuota $OneDriveStorageQuota -StorageQuotaWarningLevel $OneDriveStorageQuotaWarningLevel
Write-Host "Achieved"
That’s it. Now we have set a OneDrive quota for a person.
However now we’re attending to the actual deal. With the file generated above, we will set quotas for all customers, . That is known as automation.
# Automation
$urls = Get-Content material $homedesktopOneDriveSites.log
$OneDriveStorageQuota = "2097152" # MB
$OneDriveStorageQuotaWarningLevel = "1000000" # MB
foreach ($u in $urls) {
Set-SPOSite -Identification $u -StorageQuota $OneDriveStorageQuota -StorageQuotaWarningLevel $OneDriveStorageQuotaWarningLevel
}
That’s what I needed to indicate on this publish. I hope it was useful.
Revealed by