Well, firstly, I highly recommend using the excellent SysInternals ProcessMonitor to help fix any problem like this: Process Monitor .
This application will basically tell you about every action that the process is trying to take, so in your situation you will see that it is trying to call QueryOpen , ProcessCreate , etc.
Have you verified that the ExitCode of the process is under an unsuccessful script? I would be ready to bet on real money returned as 0xC0000142 (-1073741502) , which means something like "failed to load DLL" or something like that. Running anything within the system32 path, even with privileged user credentials, will be triggered by remote access issues with permissions, again due to the initialization procedure to create the process.
Basically, the Process.Start stream looks something like this:
(assumptions: UserA == the w3wp process is running, UserB == impersonation ctx, UserC == credentials specified in the process startup information)
First, UserB will not have much impact, as we discussed in other conversations; any material for creating the process will be based on the process token of the "launching object", so the UserA credentials are the ones we will look for.
The runtime says: "Hey, can UserA access the file name specified in StartInfo.FileName ?"
Windows answers yes / no, but also "BUT, to use this, you must also be able to read all these other DLLs"
The runtime replies, "Well, can user access to these dlls?"
If the answer to all of the above is yes, then the runtime says "OK, log in to this user and try to create a new process using the line and cmd arguments ..."
Most likely, you are faced with C # 2 or # 4 problems, because the default application pool identifier does not have read access to the System32 folder. That is why when you switch the identity of the w3wp process to a privileged account, it works.
You can try a couple of things, but the easiest option is probably to switch to an account with a low privilege level (for example, the default application pool identifier), but provide read-only access to the system32 folder of this account.
I would ABSOLUTELY not run w3wp as a privileged user, though - it is just asking for massive headaches if something unpleasant happens, as if someone was hacking you.
Oh, last thoughts:
DO NOT set UseShellExecute to true, if you can help it, this is strange.
DO NOT set LoadUserProfile to true, if you can help it, it also does strange things, and also very slow.
DO set CreateNoWindow to true if you can, otherwise you will see that lots windows open / close on the server.
DO use RedirectStandardOutput / RedirectStandardError instead of pipelining output, it is more manageable and gives better feedback when something is wrong.
DO always check the ExitCode of the process if it does not look as if it worked