Create a batch file by doing the following:
1) Open notepad and enter the following lines:
RD /S /q "C:\Documents and Settings\"UserName without quotes"\Local Settings\History"
RD /S /q "C:\Documents and Settings\Default User\Local Settings\History"
RD /S /q "D:\Temp\" <--"Deletes temp folder, type in the location of your temp folder"
2) Save the fily and then rename is something like deltemp.bat
3) Now click Start, Run and type in gpedit.msc --->Computer Configuration --->Windows Settings --->Scripts and double click on Shutdown --->Click Add and find the batch file you created and press ok to set the script
Tweak worked wonders for me, hope it works well for you.