This project has moved. For the latest updates, please go here.

problem with log on trigger

Jan 15, 2010 at 2:06 PM

I have the codebase as below to start a program when the system logs in.

TaskService ts = new TaskService();

TaskFolder tf = ts.RootFolder;

TaskDefinition td = ts.NewTask();
td.Principal.LogonType = TaskLogonType.InteractiveToken;

td.Actions.Add(new ExecAction(strInatalledPath, "/s", null));

LogonTrigger lTrigger = (LogonTrigger)td.Triggers.Add(new LogonTrigger());

Task runningTask = ts.RootFolder.RegisterTaskDefinition("LogonTask", td, TaskCreation.CreateOrUpdate, null, null, TaskLogonType.InteractiveToken, null);

 

The task is creating perfectly with "NT AUTHORITY\SYSTEM" account,

but it works on some computers in our domain and for others as soon as the system logson, the task starts and it can also be seen in the task manager running, but will not show up the real program (like showing dialogs of the program )that has started. (all systems in the domain have been tested by users having administrator permissions)

when we kill the process in task manager and start the actual program manually it runs perfectly showing up the dialogs of the program started.

so, please tell me where I am doing wrong and kindly assist me to obtain the required functionality.

 

Coordinator
Jan 21, 2010 at 6:56 PM

Given what you've provided, my only guess is that it has to do with the permissions of the interactive user on the remote system. It may also have something to do with timing. I have seen on rare occasions where a task that begins immediately after login gets started before the UI can handle it. You may want to try adding a small delay to the trigger and see if that helps.

Can you provide more information on anything common between those systems where it works and where it doesn't work? If there is more detail on the problem, I may be able to help formulate some other possible solutions.