共用方式為


Office 365 - Tracking OneDrive for Business Adoption

I was recently asked by a customer to assist them analyse their OneDrive for Business adoption, it's simple enough to see how many OD4B sites that have been provisioned using the "One Drive for Business sites deployed" report which is available via Office 365 Admin Center > Reports. However, just because a user has a OD4B site it doesn't necessarily mean that they are using it!

I create a PowerShell script (what else!) to collect data from each OD4B site to facilitate usage analysis, this outputs the following information for each OD4B site to a CSV file named OD4BUsage.csv that get's created on the desktop of the user who executes the script.

  • URL
  • Size (MB)
  • Total number of files
  • Oldest file date (to determine when the OD4B site became "active")
  • Newest file date (to see when content was last created in the OD4B site)

The user executing the script requires Office 365 Global/SharePoint Administrator permissions and Site Collection Admin permissions to each OD4B site.

I created a second script to facilitate adding these permissions for a named user, which can be found here - https://github.com/brendankarl/Office-365-PowerShell/blob/master/Analysis/OD4B-AddPermissions.ps1 simply update the $UserToAdd variable and execute.

An alternative option is to add a user/group as a My Site Secondary Admin within the SharePoint Admin Center > User Profiles > Setup My Sites. A big thanks to my colleague Dima Chernov for letting me know about this

One thing to note is that this only applies to new OD4B sites that are created, therefore unless you configure this on day one the assigned user/group will not have access to all OD4B sites - only new one that have been created. You may need to use a combination of the two approaches:

  • Execute the OD4B-AddPermissions Script - to assign permissions to existing OD4B sites
  • Configure a My Site Secondary Admin - to ensure that new OD4B sites allow access to the designated user/group

Once the permissions are in place, you can then execute the script to collect the data - https://github.com/brendankarl/Office-365-PowerShell/blob/master/Analysis/OD4B-Usage-Extraction.ps1. It will prompt for credentials and the name of the tenant.

You may now be thinking great, I have a CSV file with a bunch of information - what next! In my case I used Power BI Desktop to analyse the data and put together the reports below:

One thing to point out is that the data collection script isn't very performant therefore it isn't suitable for larger tenants - 10k+ users, unless you don't mind waiting a few days for the script to complete!

Brendan Griffin - @brendankarl

Comments

  • Anonymous
    September 23, 2015
    Very nice work here Brendan - One small point the URL for the first script has a trailing comma - which forces a 404 error

    Good to see your stuff is on GitHub too :-)
  • Anonymous
    September 23, 2015
    awesome stuff
    thanks
  • Anonymous
    September 23, 2015
    @Ryan - Thanks for that!
  • Anonymous
    February 29, 2016
    Great!

    I modified the script a bit to use a csv as input so I can target groups (we do have a very large tenant).

    When running though for some reason it doesn't pull size for anyone, and oldest/newest not for all users; only a subset. Very strange :-(

    Thanks for sharing though!
    • Anonymous
      May 28, 2016
      Apologies, this was an issue with the script. Should be all sorted now.
  • Anonymous
    April 07, 2016
    Hey thanks for your script
    I run both scripts and i'm still getting access denied error on each personal site, is there anything else i should do?
    • Anonymous
      May 28, 2016
      Have you verified that the account you are running the script with has been successfully granted permissions to the OD4B sites?