Prior to a 'forced' Windows Shutdown or Reboot, How can I save the Desktop Layout settings as these are not routinely saved during a forced operation?

What is the code or API call that can be run to do this?