Hi David,
In one of our test machines running 64-bit Windows 7 Pro, selecting the Run with highest privileges option causes an Access denied error:
Access denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at
Microsoft.Win32.TaskScheduler.V2Interop.ITaskFolder.RegisterTaskDefinition(String Path, ITaskDefinition pDefinition, Int32 flags, Object UserId, Object password, TaskLogonType LogonType, Object sddl)
at Microsoft.Win32.TaskScheduler.TaskFolder.RegisterTaskDefinition(String Path, TaskDefinition definition, TaskCreation createType, String UserId, String password, TaskLogonType LogonType, String sddl)
at Microsoft.Win32.TaskScheduler.TaskFolder.RegisterTaskDefinition(String Path, TaskDefinition definition)
at ...
The error originates from a call to the RegisterChanges() method (see last line):
public void RegisterChanges()
{
if (this.Definition.Principal.LogonType == TaskLogonType.InteractiveTokenOrPassword || this.Definition.Principal.LogonType == TaskLogonType.Password)
throw new System.Security.SecurityException("Tasks which have been registered previously with stored passwords must use the TaskFolder.RegisterTaskDefinition method for updates.");
TaskService.GetFolder(System.IO.Path.GetDirectoryName(this.Path)).RegisterTaskDefinition(this.Name, this.Definition);
}
Settings:
Run whether user is logged on or not. Do not store password
Run with highest privileges
I did run icalcs to set write permissions to the tasks folder (c:\windows\system32\tasks), to no avail.
Thanks, Audi