Source: stackoverflow.com --- Tuesday, July 26, 2016
My C# code is running on a faraway Windows Server where I cannot login, only deploy code. I want to run Process Monitor from that code - start it in "quiet" mode, then stop it after a while. The code which would run Process Monitor is running under "NT AUTHORITY\SYSTEM" local account so I assume it has all the rights required. However if I run Process Monitor on my developer box it triggers a rights elevation prompt. If I run it from command line locally: procmon /Terminate then I see an elevation prompt, confirm elevation and the process exits (as expected). If I run it from inside C# code on the faraway server: using (var process = new System.Diagnostics.Process()) { process.StartInfo.FileName = pathToProcMonExe; process.StartInfo.Arguments = "/Terminate"; process.Start(); process.WaitForExit(); WriteToLog("Exited"); } then it looks like it just hangs on the elevation prompt and the process never exits. Again I cannot login there and confirm elevation. I need to do everything programmatically. My process runs under "NT AUTHORITY\SYSTEM". How does it run Process Monitor which requires elevation without triggering the prompt? ...
from Windows http://ift.tt/2a6arNG
No comments:
Post a Comment