tags:

views:

58

answers:

3

Basically I want a windows Service that at a particular time, Logon on a windows (XP/Vista/7/2008) Machine? If this is Possible, Please show me the way?

A: 

Why do you want to do this? I assume you want to do a graphical logon, not just run code as a particular user without a GUI.

Assuming you want to logon with typical user credentials and display the Windows desktop, I think you are going to be out of luck. At least on any platform newer than Windows XP there is strict separation of service and desktop components in the OS. Windows XP allowed interaction with the desktop but it was a security risk.

There is an option in the Services MMC snap-in that details the service user account. If it runs as the local system account there is an option to allow service to interact with the desktop. I believe the logon desktop is separate from a user desktop which means that you might not be able to interact with it from a service. For instance, things like the CTRL-ALT-DEL sequence cannot be executed from code.

BrianLy
A: 

AS far as i Know, services cannot interact with the user's desktop. I looked into this a while back and never found a good answer.

There are multiple ways to configure Windows so it automatically log in as a certain user when rebooted - Not sure if that would further your cause.

Khalid Rahaman
+1  A: 

Have a look at CreateProcessWithLogonW, CreateProcessAsUser, LogonUser. If you look at the 'manpages' on MSDN, that should get you started.

CreateProcessWithLogonW()

Granted, as others have mentioned, it is very insecure.

Sean