OneDrive must be installed first.  Also be sure to sync your OneDrive account by going to this link in your browser:


I found a great script that once you set all the strings when a user executes it the document will start syncing.
Read on to find out how to find the strings needed or click here to skip to the bottom for the script.

Go to the Library you want to Sync in SharePoint and click Sync.  Click Cancel on this:

Click Copy library ID and paste the info into Notepad. (I did this in Firefox so it may look a little different for you).

Microsoft uses this format:


Using this format did work however it defaulted the name of the directory to Company Name – Documents like so:

I did not like that so I added the following at the end of Microsoft’s link:

odopen://sync/?siteId=SiteID_HERE&webId=WebID_HERE&listId=ListID_HERE&userEmail=UserEmail_HERE&webUrl=WebURL_HERE&listTitle=Company Name&webTitle=Documents

Here is my example.  Below in bold is the content I pulled out of the Copy library ID link at the beginning of this post:
(Go here to find the encoded URL characters to use when creating your url)


I then plugged those values into the formula Microsoft gave me:


Next was adding the correct email address and the name I wanted:
(@ translates to %40 and . translates to %2E)


I then copied this link into a shortcut file by right clicking anywhere on desktop>New>Shortcut:

Paste your link in then click Next:

Type a name you want then click Finish:

Now when you double click on the shortcut it should open OneDrive and ask what folders you want to sync
Also you can verify the name is correct Sales – Customers.  Click Start Sync

Now it shows up in your File Explorer with the name you wanted

This below script is a PowerShell script so name the file .ps1

One handy way to execute the below script in a bat file:
Powershell.exe -executionpolicy remotesigned -File “Path to .ps1 file”

Thank you to a person that contacted me with the below updated script. I have not tested it out yet but it looks good!!

[String]$siteid = "%7B3f1292bb%2D3a51%2D4794%2Dab48%2D2c1365a18fe7%7D",
[String]$webid = "%7B7b3f1da9%2Dac4f%2D4fc0%2Db722%2D3b895621e25f%7D",
[String]$listid = "%7B48B09FE4%2EBFAE%2D41BD%2D847B%2D209755896E96%7D",
[String]$URL = "https%3A%2F%2Fawesomecompany%2Esharepoint%2Ecom%2Fsales&version=1",
[String]$webtitle = "Sales",
[String]$listtitle = "Customers"

$rand = Get-Random -Maximum 10
sleep $rand
#Sleep is required, if the same script runs at the same time it'll mess up the configuration.
$Version = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ReleaseID | Select-Object ReleaseID
if($version.releaseID -lt 1709) { break }

$UPN = whoami /upn

$path = "$($env:profile)\OneDrive - $($listtitle)"
if(Test-Path $path){
} else {
start "odopen://sync/?siteId=$siteid&webId=$webid&listId=$listid&userEmail=$upn&webUrl=$URL&webtitle=$webtitle&listtitle=$listtitle"