Easy automapping “Office 365 Groups” drives with OneDrive

4 min read

OneDrive helps you in moving department fileshares / drives to Office 365 and keeping users happy.


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

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 functionality Exchange 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!

OneDrive, Powershell and the Microsoft Graph API to the Rescue

Graph API

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!


AutoMapUnifiedGroupDrives.ps1 on GitHub (legacy version!)


Final Thoughts

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:
https://developer.microsoft.com/en-us/graph

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

Michael Mardahl

Michael works as a Cloud Architect with APENTO in Denmark. Specializing in customer journeys from classic Infrastructure to Cloud consumption. He has been in the IT industry for more than 20 years, and has experience from a broad range of IT projects. When not at work, Michael enjoys the value of spending time with family and friends, and BLOG's passionately about Enterprise Mobility whenever he has time to spare.

Recent Posts

Passwordless journey with FIDO2 – Part 3 – Engine troubles

After a few months away from bloggin because family and holiday and one self is important to tend to, I…

4 years ago

Conditional Access and the woes of being an external user

Conditional Access and multi tenancy can be tough on anyone... (more…)

4 years ago

Passwordless journey with FIDO2 – Part 2 – Usage experiences

Continuing my ongoing series on passwordless with Azure AD and FIDO2... The story continues on SCConfigMgr.com... :) https://www.scconfigmgr.com/2019/11/18/passwordless-journey-with-fido2-part-2-usage-experiences/

4 years ago

Passwordless journey with FIDO2 – Part 1 – Getting started with security keys

Passwordless with FIDO2 is becoming a real option for enterprises that are adopting the cloud. In this guest blog post…

5 years ago

Unattended access to Exchange Online using a privileged account with MFA enforced

I published a PowerShell Gallery script, that will get you through this headache in a jiffy. (more…)

5 years ago

2 Cool new password policy features in Azure AD Connect

Enabling preview features in Azure AD to extend your on-prem password policy to Azure AD. (more…)

5 years ago

This website uses cookies to track views anonymously with analytics.