You can create a GPO that will set IE to delete cookies and internet temp files when the user exits. The GPO can also set the temp folder contents ti be deleted when the user shuts down
For best performance the GPO should be created in each domain
the defag and disk cleanup can’t be done this way. You could write a WMI script to perform the defrag
Defragmenting a volume
Your desire to automate those tasks really need a complicated software that should be coded properly. Now, if you really need to automate those tasks, hire a professional programmer and specify your needs. Make sure that the program could run on a network based environment.