If you redirect the Documents folder (or My Documents on XP) to a network drive, an instance of the Recycle Bin is created on the user’s home directory. And, because the default size for the Recycle Bin is 10% of available space, you can end up with a huge amount of space chewed up by these hidden folders.
NetBinCleanup.vbs is based on a PowerShell script (http://baldwin-ps.blogspot.com/2013/07/empty-recycle-bin-with-retention-time.html). I decided to use it as an guideline for a vbscript which would only delete aged items on network based Recycle Bins. Why vbscript? Because in my environment, vbscript is easier to deploy an run on all computers than PowerShell.
There are some interesting things in the script, such as the StripHigh function which removes high ASCII and strips Unicode from a string. The author of the PowerShell script suggest running the cleanup at logoff, but I suggest running it at logon with the command start /b cscript.exe netbincleanup.vbs. If you set this as a logoff script, you will may delay logoff for an annoying amount of time.
I have hardcoded the retention days at 7 days as a constant in the script. There is also a test variable which you can set to popup the results of the script. I am sure that you would never put into production something you had not read an tested — so I put a lot of comments in this file to make clear what is going on.
Note: The original version only deleted files. The updated version of NetBinCleanup.vbs adds deletion of recycled folders, too.