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

Windows 7 Service or Group Account

Jan 23, 2011 at 7:55 PM

I have tried what seems like a million ways to get the Service and Group TaskLogonType method to work on Windows 7 (I *have* been successful with ID/password using password method). With the Service method, I've tried "SERVICE" and "NT AUTHORITY/SERVICE" as well as NullChar for ID and password.

As a side note, on Windows 7, I was able to get the ID/password method to work only with RunLevel set to LUA. It would not work with "Highest Available".

Anyone have any ideas how to get Service and Group methods to work on Windows 7 and/or some source code that you've gotten to work?

Thanks!

Coordinator
Jan 24, 2011 at 4:33 AM

You only need to create a TaskDefinition with the action and trigger you want. Once created, you need to register the task with the following code:

ts.RootFolder.RegisterTaskDefinition(taskName, taskDef, TaskCreation.CreateOrUpdate,
  "SYSTEM", null, TaskLogonType.ServiceAccount);
OR
ts.RootFolder.RegisterTaskDefinition(taskName, taskDef, TaskCreation.CreateOrUpdate,
  "Guests", null, TaskLogonType.Group);
Jan 24, 2011 at 7:10 PM
Edited Jan 24, 2011 at 7:12 PM

Yeah, that was the code I already had. It seems as though some user accounts on Windows 7 do not have access to the Task Scheduler service account, even if they are in the Administrators group. My code has since been tested on Server 2008, and it worked just fine for creating a service account task.

I plan on trying one more thing with Windows 7... using Run As Administrator on the EXE, then trying to set up the service account. Maybe that will "fix" it.

Thanks.

Coordinator
Jan 24, 2011 at 9:10 PM

The code I posted did work when running as administrator on Window 7. Please post any specific instances you have come across that work and don't work so the community can enjoy the benefits of your testing.