Security Explanations and Samples
Below are some discussions and sample code related to the following tasks:
Connecting to a remote server or local server with different credentials
In calling the method, there are some settings to note:
- Either do not use the last boolean parameter (as in the example below) or set the value to 'false' to make sure that the newest version of the library is used.
- Do not put backslashes in front of the server name.
- If calling this method from within code, make sure that UAC or IIS settings aren't preventing your full rights from being available.
There are some important security considerations too:
- By default, to schedule a task, you must be a member of the Administrators, Backup Operators, or Server Operators group on the local computer.
- By default, when creating a scheduled task, you cannot enter a user who belongs to a group that has more rights than the group you belong to.
- By default, a user who creates a task can read, update, delete, and run the task.
- Members of the Administrators group or the SYSTEM account can read, update, delete, and run any tasks. Members of the Users group, the LocalService account, and the NetworkService account can only read, update, delete, and run the tasks that they have created.
- If you are connecting to a remote computer running Windows Vista or Windows Server 2008 from a computer running Windows Vista or Windows Server 2008, you need to enable the Remote Scheduled Tasks Management firewall exception on the remote computer. To allow this exception click Start , Control Panel , Security , Allow a program through Windows Firewall , and then select the Remote Scheduled Tasks Management check box. Then click the Ok button in the Windows Firewall Settings dialog box.
- If you are connecting to a remote computer running Windows XP or Windows Server 2003 from a computer running Windows Vista or Windows Server 2008, you need to allow the File and Printer Sharing firewall exception on the remote computer. To allow this exception click Start , Control Panel , double-click Windows Firewall , select the Exceptions tab, and then select the File and Printer Sharing firewall exception. Then click the Ok button in the Windows Firewall dialog box.
// Connect to the computer "REMOTE" using credentials
TaskService ts = new TaskService("REMOTE", "myusername", "MYDOMAIN", "mypassword");
Creating tasks that run non-interactively
Work in progressCreating tasks that run as a system account
Work in progressCreating tasks that run as a different user
Work in progress