Search code examples
c#windowsprocesswindows-serviceswindows-server-2012-r2

Process.Start() working under Win7 and Win8 but not Windows 2012 R2


My program, run via a Windows Service was able to successfully run the following code under Win7 and Win8.

Log("About to run the file...");
try
{
    Process.Start(filePath, args);
    Log("File Triggered!");
}
catch (Exception ex)
{
    Log("Error.");
}

Although the UI of the program located at filePath was never shown, but the program did its job completely in the background.

When I try the exact same program on a Windows 2012 R2 environment, I notice that after receiving the first log message above in my log file ("About to run the file...") nothing else is logged and Process.Start() does not work either. This is confusing because the exact same program worked in other operating systems.

So if Process.Start() is not called successfully, who do I not receive the "Error" message in my log and if Process.Start() is run, why do I not get the "File Triggered!" message?

Update: Following the comments, I ran Process Monitor and this is the log generated for the target .exe file at the exact minute that it was supposed to run. Please take a look and see you find anything suspicious:

Link to log spreadsheet on Google Docs


Solution

  • Windows Server 2012 blocks all the files copied from other places. So I unblocked all the program files. Thanks for your help.