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?