Connect to Sharepoint Online PowerShell
##Connect to SharePoint Online
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force;
Install-PackageProvider -Name NuGet -Force;
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted;
Install-Module -Name Microsoft.Online.SharePoint.PowerShell;
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking;
Connect-SPOService;
Get All OneDrive Sites usage details
Get-SPOSite -IncludePersonalSite $true -Limit all `
-Filter "Url -like '-my.sharepoint.com/personal/'" |
Select URL, Owner, StorageQuota, StorageUsageCurrent, LastContentModifiedDate | Out-GridView
Export results to a CSV file
##Get All OneDrive Sites usage details
$CurrentDate = Get-Date;
$CurrentDate = $CurrentDate.ToString('MM-dd-yyyy_hh-mm-ss');
New-Item -Path "$env:temp" -Name "O365" -ItemType "directory" -Force
Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'" |
Select URL, Owner, StorageQuota, StorageUsageCurrent, LastContentModifiedDate |
Export-Csv $env:temp\o365\Report_$CurrentDate.csv -NoTypeInformation | Start $env:temp\o365;
5/5 - (1 vote)