Ultimate folder redirection for Onedrive, Teams and Sharepoint (2024)

Subscribe

This site uses Akismet to reduce spam. Learn how your comment data is processed.

64 Comments

Most Voted

Newest Oldest

Inline Feedbacks

View all comments

Ultimate folder redirection for Onedrive, Teams and Sharepoint (2)

4 years ago

Hi Jos,

A quick question. If I have users in multiple departments, can the script be used in a cumulative fashion?

IE, if I were to have a base all users script, but I had some users in finance, and some in HR, and a couple across both those functions, could I deploy the script to their security groups and have them syncing all of the libraries they need for their job, or would whichever script ran last over-write the previous scripts?

4

Reply

View Replies (1)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (3)

Sjaak

4 years ago

Hi Jos, great script! We are testing it right now. But after the client reboots, the Library sync is gone. We have this with all the clients.
Can’t find why..

Any idea?

The personal Onedrive sync will be fine after reboot. It’s just the shared library sync.
And if a set the library sync manually (via sharepoiint itself), the sync stay after reboot.

2

Reply

View Replies (2)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (4)

Jeff

3 years ago

Hey Jos,

Is there a way to stop the script from running? I’ve deleted it from Intune but on a test device the script is still looping and failing because the test user doesn’t have access to one of the libraries which I’ve defined.

My idea was to have one script with all of our shares and was hoping the script would loop through and add the libraries the users has permissions for and skip any which the user does not have access to.

Is this possible?

Thanks,

Jeff

1

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (5)

4 years ago

I Get from intune that the scripts is run, but noting on client.
When i go to c:\windows\temp and have a look at the log i can se there stands.

Running as system, Running in system Context, script shot be running in user context, we should auto impersonate?

1

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (6)

Redirecting anything to Onedrive for Business | Liebensraum

2 years ago

[…] Ultimate folder redirection […]

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (7)

Full HD

3 years ago

The impersonation no longer appears to work on 20H2 has anyone else experienced this?

If i turn off run as system the script works.

If i turn on run as system. The log appears in C:\Windows\Temp.. but never runs as each user at logon.

Is there an update / fix?

Thank you!

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (8)

G Wendt

3 years ago

Everything seems to work for m except for the impersonation part. I have to run it under an admin account or it doesn’t work.

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (9)

Wayne

3 years ago

Having some issues with duplication of libraries and a ‘AutoMapTestTeam’ library that I can’t seem to remove.

Is there a way to clear all previously sync’d libraries and start over?

Thanks – Great tool by the way.

Wayne

Reply

View Replies (1)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (10)

SRasschaert

3 years ago

Please cancel all my comments, I made a typo 🙂

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (11)

SRasschaert

3 years ago

Hi

First of all, I want to thank you for this great script and your contribution to the community!

I wanted to let you know that I am running into an error.
I configured the list of Libraries as indicated in you manual, because I do not want to syn any libraries.
$listOfLibrariesToAutoMount = @()

However, I receive an error at the following line,

$targetPath = Join-Path -Path (Get-Item “$($Env:USERPROFILE)\$companyName\$compositeTitle”).FullName -ChildPath $redirection.targetPath

Error: Get-Item : Cannot find path ‘C:\Users\xxxxxx\%COMPANY%\ – ‘ because it does not exist.

Last edited 3 years ago by SRasschaert

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (12)

Iain

3 years ago

I’m seeing an issue in our environment when signing into a new Azure AD joined device where the script appears to run successfully, but the users folders are not redirected to OneDrive. I think the issue may be that we previosuly did folder redirection via a GPO when devices were Hybrid joined, meaning all the folders we want to redirect now via the script are already present in the users OneDrive. What would be a good solution for that?

Reply

View Replies (3)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (13)

4 years ago

Hi.

Is it posibel to have the script to remove old folders?

i try to set up for some folders on one document libery, but know we have decided to make a hole new setup on a new document libery.

But in my test i have removede the older foldes but it dont remove it?

any good ideers?

Reply

View Replies (2)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (14)

Jeff

4 years ago

Hi there,
I love the idea of this but I can’t seem to get it to work. I followed the steps and left the powershell script clean (other than the proper tenantID). It will log my test user in but it pops up a window of Microsoft OneDrive and it just says Loading forever. If I close it, it will re just reopen and never load anything. What I’m really trying to do is redirect the Video folder but that doesn’t seem to work either…help?

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (15)

PacketThrower

4 years ago

This script is fantastic, exactly what I needed! I have one question.. I have a client whom has over 18 sites, and some users may or may not have access to all. Currently I’ve added 2 sites, one ‘testuser’ has access to and another he doesn’t. it keeps on continuously generating the need to add in that site.. Is there a way to close that loop is that person doesn’t have permission? I’d rather not create 41 Posh scripts :).

Reply

View Replies (1)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (16)

4 years ago

Hi. So great a script.
we just see some problems if a user dont have access to a sharepoint folder.
Then the scripts keeps going in a loop telling onedrive dont have access to the folder..
is there a fix for this?

Reply

View Replies (1)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (17)

Tarik

4 years ago

Hi Jos,

Thanks for the script. I’m getting the following error, any ideas?

Sending ODOpen command…
start : This command cannot be run due to the error: Application not found.
At C:\Users\xxx\Desktop\Invoke-O4BAutoMount.ps1:642 char:17
+ … start “odopen://sync/?$($library.syncUrl)&userEmail=$([ur …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

Reply

View Replies (1)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (18)

Rene

4 years ago

Hallo Jos,

Is het ook mogelijk om Bovenaf dus in ons geval per school het te koppellen? nu zou ik elke bibliotheek los moeten doen wat een hoop werk is. zou het ook kunnen dat ik de school site toevoeg en dat ze daaronder dan alle bibliotheken ziet?

ik kan dat wel doen met de Onedrivemapper zodat ik alleen de school site hoefde in te geven en dat ze op basis van rechten de onderliggende bibliotheken zagen.

Reply

View Replies (8)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (19)

Andrew Taylor

4 years ago

Great script! What happens if a user has redirected app data and then rebuild the computer? Will it overwrite the previous app data with the new blank one from the rebuild? I’d like to protect signatures, auto text etc. Would it be safer to just not copy existing files?
Thanks

Reply

View Replies (2)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (20)

Rene

4 years ago

Heey Jos,

Misschien is een mogelijkheid om aan het script toe te voegen dat de offline bestanden na een tijdje verwijderd worden lokaal. wat de functie opruimen doet van onedrive. er is ook zoon functie in windows maar ik heb nog niet kunnen vinden om dit voor alle computers/users door te voeren dat hij bijvoorbeeld na 3 dagen de offline bestanden opruimd en omzet naar alleen online bestanden.

Reply

View Replies (2)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (21)

Collin

4 years ago

Hi Jos, great script, thanks for that! I have one ‘issue’ which you might be able to help solve. We have a Team and there are several files and folders in the document library of that Team. When I connect Onedrive using your script, I see all my files and folders INSIDE a folder called ‘General’. Our users than have to open that folder ‘General’ and they will find all files and folders that are also visible via the Teams app. But when they make other folder at the same level of the General folder, no one will be ableRead more »

Reply

View Replies (2)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (22)

Raj

4 years ago

Hi,
Just noticed something strange when running the script, I get “OneDrive not yet fully configured for this user….”
Checking the script there is the line
if($account.GetValue(“Business”)
However checking the registry on my system I have Accounts\Business1 so the test fails and the script fails.

Will see if I can fix and post back.

Thanks

Raj

Reply

View Replies (1)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (23)

4 years ago

If i wanted to map multiply folders, it only maps on.

$listOfLibrariesToAutoMount = @(
@{“siteTitle” = “Alle”;”listTitle”=””;”syncUrl” = “tenant…”}
@{“siteTitle” = “Oekonomi”;”listTitle”=””;”syncUrl” = “tenant…”}
@{“siteTitle” = “Personale”;”listTitle”=””;”syncUrl” = “tenant…”}
)
am i doing something wrong?

Also, i get notifiet all the time that the foldes is allready in sync.
it pops up with 2 min between

Reply

View Replies (6)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (24)

Michael

4 years ago

Hi Jos,

Create artikel! It is definitely what i was looking for!

If you declare a space within the siteTitle of $listOfLibrariesToAutoMount it gets recplace for a + sign by [System.Web.HttpUtility]::UrlEncode.

If you use [uri]::EscapeDataString it will change to %20 so people see a normall space wihtin explorer.

Is there a particular reason why you use [System.Web.HttpUtility]::UrlEncode?

But again create script! Will proberly use it alot

Reply

View Replies (1)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (25)

Sasaus

4 years ago

Thanks for this. Is it possible to have the name be the same as when you hit the Sync button?

For example a document library named Apps in a SharePoint site named Files gets the name Files – Apps when synced manually through the button.

With your script it gets the name Apps – Documents.

I use applications that get certain data from synced SharePoint sites, but I cannot set multiple possible paths to the folder location.

Reply

View Replies (1)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (26)

Testy

4 years ago

How would this work on a shared computer?

Reply

View Replies (2)

Ultimate folder redirection for Onedrive, Teams and Sharepoint (27)

Roaming Chrome settings with Intune MDM | Liebensraum

4 years ago

[…] As you may have noticed, I’m using an environment variable here called ${DOCUMENTS}. This variable is a google-specific variable, you can’t use environment variables here like %APPDATA%, if you want to roam to a different location, use my Ultimate redirection script […]

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (28)

O4BClientAutoConfig | Liebensraum

4 years ago

[…] ARTICLE SUPERCEDED BY Ultimate folder redirection for Onedrive, Teams and Sharepoint […]

Reply

Ultimate folder redirection for Onedrive, Teams and Sharepoint (2024)

References

Top Articles
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated:

Views: 6344

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.