This blog post gives you a quick walkthrough of how you can prevent OneDrive from syncing shortcuts with MEM Intune.
Bet before we get started, lets understand…
Table of Contents
Why do we need to prevent OneDrive from syncing Shortcuts?
If you have OneDrive Known Folder Redirection enabled for your Windows 10 endpoints and there are no measures to prevent desktop shortcuts and links from syncing to OneDrive, then, if for any reason, a user needs to do a system reset, post system reset and re-provisioning, the user will be seeing duplicate icons appearing on the desktop.
This is annoying and surely not a good user experience. The reason why we need to prevent OneDrive shortcut sync.
Create Administrative Templates profile in Intune to prevent OneDrive Shortcut sync.
In the Endpoint Manager admin center
- Navigate to Devices >> Windows >> Configuration profiles
- Click Create Profile
- Select Windows 10 and later as Platform
- Choose Templates as Profile type
- Select Administrative Templates
- Click Create
- Give the profile a Name
- Enter a Description (Optional)
- Click Next
- Select OneDrive from under Computer Configuration
- Search for Exclude
- Select Exclude specific kinds of files from being uploaded
- Select Enabled
- Enter “*.lnk” and “*.url” in the text boxes
- Click OK
- Finish creating the profile by adding scope tags as per requirement and assigning the profile to the required group.
Noticed the new Filter option while making assignments.
Check my previous blog post on the same to know more about the new filters option in Intune.
How the Intune Admin Template policy to prevent OneDrive Shortcut sync works?
If the exclusion of shortcuts and links is configured along with the OneDrive Known Folder redirection, the shortcuts on Desktop are not synced to OneDrive.
This prevents the issue that we started with – having duplicate icons on the desktop due to OneDrive sync.
However, if the exclusion of shortcuts and links is not configured along with OneDrive Known Folder redirection policy but configured at a later stage, in such case, the exclusion settings will only work to prevent syncing the new shortcuts or links, post the profile taking effect on the endpoint.
It will not remove existing synced shortcuts or links. As such, existing synced shortcuts will continue to exist and cause the duplicate icons issue on the desktop.
You can, however, delete those existing duplicate shortcuts (the ones with Copy in the name) from OneDrive by making use of PowerShell. A very raw example would be
$dir = "$env:USERPROFILE\OneDrive - LearnIntuneWithJoy\Desktop" <#Path to OneDrive#>
Get-ChildItem -Path $dir | Where-Object Name -Like '*copy*.lnk' | ForEach-Object { Remove-Item -LiteralPath $_.Name}
Wrap Up
That was all for today. Thanks for reading!
More Information: