Samba provides functionality for this. I used to do this all the time, but I haven't touched it in a while. To start, take a look at this link that outlines the basic steps to the logon process.
Chapter*26.*System and Account Policies
You will need to create a [netlogon] section in your smb.conf. Also, take a look at the documentation for the following parameters. They will provide some of the functionality you need without the need for running a logon script.
Code:
logon script
logon home
logon path
logon drive