Tuesday, 29 July 2014

Recycling Bin with Redirected Folders

Recycle Bins and Redirection

The Recycling Bin found on your desktop opens up a window and within that window you have all the items that you have deleted, either accidentally or deliberately.

What you might not know is that every redirected folder has its own recycling bin. If you have 10 redirected folders you have 10 additional recycling bins, all with their own settings and storage capacities.

You also always have your local recycling bin for every drive. So if you have a C:\ and D:\ drive, you have a recycling bin for both the C:\ and D:\ Drives.

10 Redirected folders + 2 Drives = 12 individual recycling bins.

If you have redirected the music, video and pictures to follow the my documents, you have -3 recycling bins because the music, video and pictures will use the my documents recycling bin. Just to add to that annoyance.

So when you open the recycling bin from the desktop, you are basically taking all x amount of recycling bins (in our example 12) and viewing them all in one place with no indication of which recycling bin the files exist in.

Below is an example where I have made Pictures and Music have their own redirection and "Videos" follows the Documents folder.

So even though I have one view, the files are actually stored in a completely different locations.

Locations

So lets say you map a drive the P:\ drive to the client. This P:\ drive is their personal drive. This drive is a unc path of:

\\file-server-01\studentsdrives\%username%\documents.

The Recycling Bin will be found by adding $recycle.bin to the end of that unc path.

Following from my example above I see:

Notice now in my "Documents" recycling bin I have lost the Music and Pictures files. This is because they reside in a different recycling bin:

\\file-server-01\studentsdrives\%username%\Music\$Recycle.Bin

\\file-server-01\studentsdrives\%username%\Pictures\$Recycle.bin

So what does this mean for me?

You are an IT Admin and you damn well know people store stuff in their recycling bin and don't delete it. Now if they do this, then you could have large files that are pending deletion sitting on your server as every redirected folder has their own recycling bins.

I found that a student.. copied a DVD to his "My Videos" file (3.2GB), watched the DVD and then deleted the file. To him, the file was deleted. To the Server, it was still there in his Recycling Bin. Even though the My Documents Recycling bin was limited in size, his My Videos Recycling bin has its own size limit and as a result he ended up with a total of 11GB of deleted files when we calculated the combined total of his recycling bin.

That was one student.. . In high schools with over 1k in student numbers, this is a massive drain on server resources, naturally it justifies the nice new SAN system you want, but schools don't have much money anymore, they never did to begin with and it is just getting worse.

So how to I manage it?

Well this is the tricky bit now, because there is no pre-set GPO to deal with this.

The easiest way is to use File/Folder Quota Management. Each recycling bin is set to use a percentage of the allocated size of the allowed disk, but this depends on your folder structures and redirection as you can say your personal folders are only allowed 10GB but your profile folders might be in a different location and you need to then set quotas for those as well.

Customized GPO

I took the liberty to create a GPO that will enable you to disable and/or specify sizes for each individual redirected folder recycling bin.

I have tested this with Windows 7 and have confirmed the settings for higher versions.

You can completely disable the redirected folder recycling bin (above)

Or you can specify the size of each redirected folder's recycle bin.

If you right click on your recycling bin on your client computer, you will find where these settings will apply:

For each recycling bin you either set it so it doesn't move the files to the recycling bin and just deletes them with immediate effect or alternatively you can set the size in MB within the policy.

For example, I have had my Pictures, Videos and Music to follow the documents folder, I have set, using my GP Objects to limit the documents recycle bin to 3GB and have disabled every other recycling bin.

If they deleted an item from their downloads folder by accident, I can recover it anyway using shadow copy.

This is how I solved it and if anyone else if having these issues, buy all means try my policies. The alternative way is to manually alter the registry for each redirected folder, but that made up about 12 preferences which I could do without. Looks messy.