W10 - Scheduled task running under the NetworkService account cannot write to a local log file

496 Views Asked by At

I have a certain .NET executable that performs some network management running inside a periodic Task in Windows 10 Task Scheduler. This task is running as the NetworkService Windows account. So far so good.

Nevertheless, I've been asked to add some logging inside the .NET executable that is launched via this scheduled task, to help pinpointing some elusive bugs we're having.

Problem is, when running as the NetworkService account, there is no way I can get the exe file to write to our main app logging folder (I guess it's a permissions issue). The logging system I included works fine by changing the user executing the task to a local user, but with the default NetworkService account it just does nothing.

Unfortunately, I'm not allowed to make any changes to the way the Scheduled Task is created, so I'm restricted to run it as NetworkService. No way around here.

I'm also not allowed to write the logs outside our main app logs folder (located on <Program Files (x86)>\Common files\Our_app_name\Logging). No alternative here neither.

Is there any way a task being run under the NetworkService account to write inside a text file to the Common Files folder of the local machine?

Thanks.

0

There are 0 best solutions below