2

I am working on a project where I have a Windows service running under Local System Account.

What I want to do is to start another process (C++ application) that should write files to disk.

If I just use Process.Start, then the target application also runs under Local System Account, and as far as I know I can not simply write files anywhere.

For this reason I'm trying to make the target application run as a different user.

ProcessStartInfo psi = new ProcessStartInfo(@"C:\Path\to\Application.exe", parameters);
psi.UseShellExecute = false;
psi.UserName = "Username";
System.Security.SecureString sec = new System.Security.SecureString();
foreach (Char c Password)
    sec.AppendChar(c);
psi.Password = sec;
psi.Domain = ".";
psi.LoadUserProfile = true;
Process.Start(psi);

But I am getting a Win32 Exception telling me the "Acces is denied". Does anybody know how I can achieve my goal?

Thomas
  • 76
  • 8
  • Have you checked the answer to [this](http://stackoverflow.com/q/16805952/806549) question? –  Oct 30 '13 at 22:16

1 Answers1

0

Check the file system permissions. Does the user you are using have execute permissions for the specified application?

Markus Safar
  • 6,324
  • 5
  • 28
  • 44