I recently wrote an article on how to create a script to empty the Trash when an Active Directory user logged out of a client computer. This required us to mess around with the trust relationship a little between the client computer and the server. Now with the use of the ‘ManagedClient.app’ and ‘Folder Redirections’ we don’t have to worry about that anymore!
So go ahead an open up Workgroup Manager. Navigate to your OD, Authenticate and head over to the Preferences window. By default you will be in ‘Overview’ mode so switch to ‘Details’ and select the + at the bottom.

Navigate to the following location and import this in the browse window that opened.
\System\Library|Core Services\ManagedClient.app
You will now have a load of new preference manifests in the Details view now. We’ll take a look at more of these another time, but for now scroll down and open ‘Folder Redirection’.

By default this will be blank, but fear not – I’ll tell you what you need to enter here. Expand ‘Always’ and hit ‘New Key’. A blank ‘New Item’ will appear with an orange icon next to it indicating that there is no managed preference yet. Click the drop down list that appeared next to the ‘New Item’ and select ‘Logout Redirections’.

Other options here include ‘Login redirections’ and ‘Other Redirections’ but we’ll take a look at these another time. Expand ‘Logout Redirections’ and click ‘New Key’ – ‘Redirect Action’ will then appear. Expand this too.
You can see some keys have been created and auto-filled. Next to the ‘Action’ key where it says ‘deleteAndCreateSymLink’ is a drop down list of other actions. They are all explained at the bottom when you select them, so I won’t go on to explain all the functions here. Take a look through all of them and then select ‘deletePath’.
Set the ‘Destination Folder Path’ and ‘Folder Path’ as follows:
/tmp/%@/.Trash
~/.Trash

This basically means that when the user logs out, the hidden .Trash folder will be deleted. Test to make sure it works by logging in to a client and then filling up the Trash. Logout and back to see if has gone through ;)



Pingback: Library Folder on Apple Macs