Starting a new user session from a service

I have the following problem:

From the service, I need to run the application in a user session. No user is logged on to this computer because it is a server. The running application must have a session! = 0.

Current "solution"

I used the scheduled task when starting the machine, launching this task (in session 0, of course) an application that launches the remote desktop login on one computer: this creates a user session> 0, and when the user starts, the final application to start. It works, but too complicated.

Is there any smart way? It is imperative that I can reuse a user session already, since there is potentially no user login.

BASIC UPDATE

After a lot of research and partial success, as well as due to some SysAdmin inflexibility about creating a user for a specific filling, I decided to use OpenGL instead of WPF to render the 3d part in session 0. Surprisingly, it took less than expected. I think this question as a link may be useful to others who want to try to display Viewport3D from a service.

+5
source share
2 answers

I'm not sure if this will work, but maybe this answer will help in your case.

Use the class from the answer I provided and the following method (with corresponding values):

public static void EnableVideoDrivers(bool enable)
{
    // every type of device has a hard-coded GUID, put here the one for
    // video drivers
    Guid videoGuid = new Guid("{device GUID}");

    // get this from the properties dialog box of this device in Device Manager
    string instancePath = @"Device Instance Path";

    DeviceHelper.SetDeviceEnabled(videoGuid, instancePath, enable);
}

Here is a list of the popular device class GUIDs .

0

, , , , - , . :

  Process p = new Process();

  p.StartInfo = new ProcessStartInfo(fileName, args);
  p.StartInfo.UserName = userName;
  p.StartInfo.Password = pass;

  p.Start();

. CodeProjecgt artice.

0

All Articles