Unable to modify file on task scheduler execution using account NT AUTHORITY\SYSTEM

125 Views Asked by At

I have an xml file which is to be modified from task scheduler .exe configured. Task scheduler runs without any error but file is not updated. I tried to log every step to see if any exception is occurring but found none.

I think this has something to do with permissions but not sure what am i missing.

Any help would be appreciated!

1

There are 1 best solutions below

0
Ronak On BEST ANSWER

Fixed the issue.

Issue was with the path of xml file to be saved. What i wrote was config.Save("File.xml"); This did not work. Then i hardcoded the complete path and it worked.

So, instead of using only filename or Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + @"\File.xml", i used AppDomain.CurrentDomain.BaseDirectory + "//" + "File.xml" and worked perfectly.