Last Updated on4 min read
UPDATE (July 2019): I have fixed some issues with the original script, which is still available. But you should consider using the new version located here: https://github.com/mardahl/OneDrive-AutoMapper
Please contribute on GitHub if you make improvements! 🙂
In this article, I will cover the bases on how I currently recommend moving department drives to Office 365. Thoughts will be shared at the end, and feedback welcomed. Finally, I will unveil a script I have created to automatically have a users OneDrive Desktop Client, populated with all available Office 365 Group Drives – that now live in SharePoint Online / Teams / Office 365 Groups / Unified Groups (Dear lord, please help people find this on google!).
N.B.: This is not a script that creates a drive letter, like the OneDriveMapper by Jos Lieben. Instead, this script saves you the hassel of having the user go click on the “sync” button on each document library in Sharepoint Online.
… if you REALLY need a bloddy drive letter, go oldsk00l with the SUBST command – that puppy still does some neat tricks!
As many European companies face the consequences of GDPR, and what to do with their trusty old file shares – some choose to go with Office 365 as their new storage space for company files.
This will lead them to use either SharePoint Online Sites with Document Libraries or the newer Office 365 Groups, which are essentially SharePoint Document Libraries with added superpowers.
I recommend using the Office 365 Groups, and preferably bringing them to life through
Microsoft Teams, as this gives them most functionalityExchange Online, so you won’t be crying later when you need that added functionality, like Teams integration. You can easily create a Team from a Office 365 group, that was created in Exchange Online, the other ay around requires powershell magic.
An added bonus of using Office 365 Groups, is that their functionality is available from a variety of devices. And you might already have department groups just ripe for conversion to Office 365 Groups, which will consolidate the work area for many types of departments – making things simpler, once users are on-boarded properly to this new way of working (But that’s a whole other article waiting to happen!).
The BEST thing about using Office 365 Groups for your department files, is that I have created a script that will get your users on-board with the new religion – a lot quicker!
Powershell and the Microsoft Graph API to the Rescue
Having looked high and low, I have not been able to find anyone who had even come close to fully Automating the mapping of Group Files in the OneDrive Client – So I took it upon myself to get to know the Graph API a little better.
The script that you are about to read has not been tested thoroughly, and is only able to map Unified Groups at the moment, though changes are fairly easy to make.
A great deal of work has gone into making the script modular and readable – and self explaining enough for most scripters to play with it.
You will need to created an App registration in Azure AD for the script to work so you should be familiar with that, if not the official docs explain it here. And I also get around to showing how in another blog article.
There is a config section in the beginning of the powershell script, which should be the only place you need to mess around.
Once done, just execute the script as your user, and you should see it mapping up groups in your OneDrive client! That is, if you have configured the newest OneDrive client (AT LEAST v18+), and are running Windows 10 1709 as a minimum. Oh! and you might also want to create some Office 365 groups if you don’t have any 😉
Now get to the chopper!
Though not perfect, this script will (when run in the users context) map all Office 365 Groups that have been made available to the user (Either owner or member).
A cleanup function would be nice for groups that have been left, but I wanted to leave something for others, so I hope to see some PULL requests on GitHub!
Although Microsoft has announced, that “Auto Mapping for Microsoft Teams Files” will come Q4 2018, I am sure this script still has some use – at least for people wanting to get busy with the Graph API in the simplest way possible through Powershell.
Also this is fully automatic, Microsofts upcomming solution is not!
To learn more about the Graph API, visit:
Thanks for reading!
As always, I hope you enjoyed the article and leave some positive feedback (It really helps to motivate me, to do more articles on Microsoft Cloud solutions and Powershell scripting).
Let me know your thoughts by following/tweeting at me on Twitter @michael_mardahl