Forum Discussion
OneDrive with FSlogix in an AVD environment how to prevent profile bloat
You can try to create a scheduled Task with the Command "c:\windows\System32\cleanmgr.exe /autoclean /d C:" on User Logon with a delay of 5 or 10 Minutes.
This will trigger a cleanup for the User.
When you use the Powershell Script for configure Storage Sense with OneDrive, this command also cleanup OneDrive Files.
- steveturnbull1975Mar 28, 2023Brass ContributorThanks this give me a direction on where to look for a solution. I didn’t bother with storage sense because it seems like not a useful feature for vdi sessions unless someone is logged
On for more than a day. I tested it over 8 hours of a logged on session and it did nothing.- Travis_78May 10, 2023Iron ContributorThats the thing. I am not sure what Microsoft wants us to do here. Do they want us to support onedrive with fslogix profiles in AVD, or not? What is the best practice for one drive in an AVD environment? I cant get a straight answer from them.
- steveturnbull1975May 10, 2023Brass ContributorI’ve basically just created a scheduled task that runs 30 mins after a user logon. It scans the users onedrive folder and checks for any files that haven’t been accessed for more than 60 days. If there are any it uses the attrib command to set them back to online only mode. The version of fslogix we use we have the auto shrink/compaction at logoff providing it’s cleaned up enough files to warrant that it will run. We also run our own fslogix shrink script written by Jim moyle each month to help. This process has helped keep the profiles under control with minimal growth over the past few weeks.
It’s a bit ridiculous that people are having to invent their own solutions for this issue when it should just be part of a onedrive policy
- Travis_78Mar 07, 2023Iron ContributorCan you confirm that this command runs against the users FS logix profile to clean up Onedrive folders?
- steveturnbull1975Mar 28, 2023Brass Contributor
Travis_78 so I’ve put together a solution that runs a scheduled task at user logon but delays it by 30 minutes so it doesn’t overload the logon process. The task goes through a users onedrive folder and “removes” locally cached files in the container which haven’t been modified for more than 30 days and sets them back to online only.
then fslogix shrinks the container at logoff.
there is some issues with onedrive (bugs) since testing however. If someone tries to download a large file to onedrive and it breaks during the process, onedrive will show the cloud icon but the partial download actually ends up in the profile container. I have no idea how to fix this. The only way this will be fixed is with the user re-attempting the same download to completion which would then flag the file with a green circle. This appears to be a major design flaw in onedrive.
the other issues I’ve come across is if the files are a cloud icon and if you attempt to copy the same files over the top from a file share and select the replace option the files remain a cloud icon but the files actually end up in the container (maybe more of an edge case)
I have serious concerns around the level of testing on this onedrive product as it seems to be pretty inconsistent sometimes in its operations.
ill be implementing the script soon to do the clean up so will see how much of a difference I see on the storage. However as mentioned there are scenarios where it’s not going to work optimally due to what appear to be bugs with onedrive