So a few years ago yes I said a few years ago, I had a customer ask if it were possible to Redirect more than just Desktop, Documents, and Pictures in OneDrive which is included natively in Known folder redirection? Interesting thought they, like many organizations have been using folder redirection of various folders in a user’s profile to different network shares to distribute file types by network share. Kind of an archaic approach but more common than you would think.
I did some digging and stumbled across some great work by josy1024 on GitHub where they had called out the windows shell to map known folder to any virtual path they had desired. This was intriguing..
Well if I could then redirect known paths path all I needed to do was operationalize this for Intune, and so I simply added a function to virtually/dynamically map these common known folders to my specified one drive folder.
You will see in the script a variable for $ONEDRIVESYNC update this for your organization.
You will also see I have some common folders all ready called out, simply comment out what you don’t want to redirect.
Next I needed a method to deliver this, for ease of use I try and keep these to single PowerShell script, but only running once wasn’t going to be enough. I needed these to be mapped every time the user logs in to ensure they were always there for the user.
This is where task schedule comes in, I love this because its support hacky. I was able to take the entire script and drop it into a content section, which I then pulled from to create a scrip on the local machine, then I move onto create a schedule task which runs that script on every logon. Some pretty fun stuff!
So need less to say this was a lot of fun, now I just need to deploy via Intune as a PowerShell script target to 64bit shell and with in a few min my users will have more than just the traditional folders redirected. This is obviously not supported by the OneDrive team, but can be a great tool to get you out of bind or help with business continuity during an on-premise to cloud (OneDrive) file transition.
Here is the entire thing! and a link..
OneDrive/Intune-SchedTsk-KFR-AllKnownFolders.ps1 at master · Mauvlans/OneDrive · GitHub