Script to list all OneDrive sites

%3CLINGO-SUB%20id%3D%22lingo-sub-2115606%22%20slang%3D%22en-US%22%3EScript%20to%20list%20all%20OneDrive%20sites%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2115606%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20PowerShell%20script%20that%20i%20could%20run%20that%20would%20list%20all%20our%20organisations%20OneDrive%20sites%20and%20write%20them%20to%20a%20csv%20file%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%3C%2FP%3E%3CP%3EOllie%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2115606%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2115855%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20list%20all%20OneDrive%20sites%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2115855%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F71651%22%20target%3D%22_blank%22%3E%40Oliver%20McErlane%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EOne%20of%20the%20options%20would%20be%20to%20use%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-pnp%2F%3Fview%3Dsharepoint-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESharePointPnPPowerShell%3C%2FA%3E%20module%20and%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-pnp%2Fget-pnptenantsite%3Fview%3Dsharepoint-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGet-PnPTenantSite%3C%2FA%3E%20cmdlet%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EGet-PnPTenantSite%20-IncludeOneDriveSites%20-Filter%20%22Url%20-like%20'-my.sharepoint.com%2Fpersonal%2F'%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20that%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hi,

 

Is there a PowerShell script that i could run that would list all our organisations OneDrive sites and write them to a csv file?

 

Thank you,

Ollie

1 Reply

Hello @Oliver McErlane,

One of the options would be to use SharePointPnPPowerShell module and Get-PnPTenantSite cmdlet:

 

Get-PnPTenantSite -IncludeOneDriveSites -Filter "Url -like '-my.sharepoint.com/personal/'"

 

Hope that helps.