There is a utility called Shutdown Monitor that prevents users from logging off or shutting down as long as a specified process is running. A quote from the site:
I really, really need to use what this program provides. I have an AutoIT script that blocks shutdown requests, but usually after the shutdown request has successfully killed processes that I need to remain running.
I have tried Shutdown Monitor and it works flawlessly. However, I cannot use it because when one tries to end the