Here's an article I used on scheduling defrags click here
I can't remember if their is an option to run at shutdown in the scheduled task settings. Will see if I can find anything more on automating a defrag when you shutdown.
Surface Pro (2017) vs Surface Pro 4
Where HTML5 is headed next
MacBook Pro v Surface Pro 5
Synology invites you to visit them at Insomnia on 26th – 29th August. Book your tickets now and visit Synology.