R – How to run GUI application without login window session


My goal is logout current session, then delete the running local user profile. And I have a service to delete the profile already.

My problem is, the user has no idea about the background service and who may power off the machine or login again too soon.

The idea is that the service will show some popup, and it will not display "Welcome to Windows" until background job finish.

I have read some tricks to run GUI application without login, but I cannot find how to it.

How can it be done on Windows XP and Vista?

Another idea came from my boss is that "Shutdown and install windows update", but execute our apps rather then patch installer.
How to install my application hooks at that point?

Best Solution

I think that if you are running on a system other than Vista, you will want to replace the GINA dll. This will give you the proper hooks into the login process to perform your work.

In Vista, you simply won't be able to do this, as GINA was replaced with credential providers, which are not queried when the user logs out.

Also, I see nothing mentioned in your question about what to do if someone logs on the machine through Terminal Services, or through another call to LogonUser. Deleting the profile when the user logs off is a bad idea, because they might be logged on more than once, so you have to account for that.