To avoid having Windows restart itself after automatic updates, do:
1. In the Start Menu click 'Run...', type 'gpedit.msc' and ENTER to open the 'Group Policy Editor'.
2. Go to 'Local Computer Policy' -> 'Computer Configuration' -> 'Administrative Templates' -> 'Windows Components' -> 'Windows Update'.
3. Double click on Entry to open up a list of settings.
4. Double click on Item 'No auto-restart logged on users for scheduled automatic updates' to open up a property dialog and change the setting to 'Enabled' (sic!).
Note, this only works with Windows XP Pro or Windows Vista Business or higher. It will not work with home editions. In that case, see the below source for more details.
Source: Comments at http://lifehacker.com/5087042/shutdownguard-stops-automatic-windows-shutdown-restart